Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

FireFly RA4 pullup help

Status
Not open for further replies.
You didn't turn the A/D ports off. By default they are enabled.

Add
Code:
  bsf   STATUS,RP0
  clrf  ANSEL  ;(this will make all pins digital)
I'll put this note in the next rev of the Firefly assembly manual (which is now 16 pages)

The CMCON used to cause lots of confusion too. On the 16F88 it's off by default
 
Last edited:
Code:
	movlw	b'00010000'
        movwf	PORTA
Those instructions have no effects on RA4 because that pin is configured as an input. You might want to check if the button is pressed with a BTFSS instruction and take some actions (toggle an LED, for example)...
Code:
	btfss     PORTA, 4      ;button is pressed?
        call      Button        ;yes.. call a subroutine; no.. this line is skipped
 
Thanks again for your help, Bill.

Of course, now that you point that out, I see the note on page 51 of the datasheet...

On a Power-on Reset, the pins PORTA<4:0> are configured as analog inputs and read as "0".

I feel like an idiot that it was that simple and I didn't see it -- well, I guess that is the course of learning. I am glad to see that I do have an understanding on pull-up resistors, etc., that I simply had the ports set as analog, rather than digital (well, there's a subject for me to do some research on!). I knew I was overlooking something!


eng1 --> That was a "last effort" before I actually asked the question here. I like to try my best to figure things out on my own (they stick more that way!), but was simply getting nowhere -- as a last try I tried to see if I could manually set the port high (I was thinking, OK, let's see if I have to tell it to be high to start with) -- I didn't think it would work, but I was desperate at that time! :eek: ;)

I actually have a small program written to pull the serial number from an iButton (the code above was simply a test to try and figure out why the pin remained low) -- but I could not get it to loop and wait for the touch of the iButton (was testing with btfsc -- as long as it's high (1) it should loop, but it wouldn't because it sat low (0) due to being configured as an analog input).

I've done a quick test just now by adding clrf ANSEL and the pin does indeed show high, so I am going back to play with the iButton code, which shouldn't be a problem to get going now!

Thanks for your comments! :)
 
I'll keep expanding the manuals, Unicorn needs lots of work and the Mongoose PCB is almost done. I burned the midnight oil last night but whew looks like the first draft layout is ready for electrical testing.

PS there is scads of iButton code on the web (1Wire) for 4MHz 16F84 (just add that ANSEL command and you can pretty much use the code verbatium.

**broken link removed**
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top