Jump to content

Need Midrange (16F87x) Specialist...


 Share

Recommended Posts

Sorry this is non-MIOS, but I guess it's still ASM. :)

How much extra init junk needs to be done to activate all five banks on a 16F87x as digital outputs?

I'm trying to play with some shift register code and rather than constructing a circuit using a smaller chip that I understand a little better, I figured I'd use this hybrid Core/JDM thing I've got, which already has most of the access available. To begin with, I figured I'd get the minimal stuff needed just to set/clear the pins I have available, and found that they didn't seem to be turning on as I requested. I then moved into MPLAB's simulator to see if I could get it going in there before blaming the circuitry.

In MPSIM, I've got the config lines and bank switching worked out OK (I think), and I've got that error suppress line to keep it from throwing the "not in bank 0" errors at me. I've also got the 16F877 file properly included. From what I can remember, I've got it switching to bank1, loading 0x00 to the WREG, then calling TRISx five times for the five ports. Then I move back to bank0, stick an 0xFF in the work register, and dump that to the five ports in a similar manner (trying to turn them all "on"), and I end it with a "looped" goto line.

What I *get* in the register view panel when I stop is (hex) 10,FF,FF,FF,00 for the five ports. I realize the A&E ports are shorter in width. I think I've even tried to access them separately with smaller numbers assigned, but get the same thing (PortE always stays off, and the fifth bit is the only thing I can successfully activate on PortA).

I'm guessing there's something special which needs to be done for those two to be seen as regular (digital) output ports (the ADCON1 register or something for instance??). Can anyone briefly point me in the right direction?

I'm also guessing there may be something about some of the pins in this circuit, which may make them unsuitable as digital outs, but I figure if I can get the simulator working for all of them, I can move to some usable pins afterward (I should have more than enough). The circuit is a 20MHz Core board with a female header for all the LCD lines, and males for the DIN/DOUT/AIN and Mux pins of the PIC. (there are likely some pullups on the required lines).

Much Thanks,

George 

Link to comment
Share on other sites

Well, I did find an old comment of TK's pointing to the ADCON1

	movlw	0x06			; PortA and E: All Pins are digital pins
	movwf	ADCON1

And can now get an 0x3F and an 0x07 for the A and E ports, which would of course be all bits active for the 6 bits of A and the 3 bit E port. :) :) :)

Sadly, that's what I get in the "virtual" world of MPSIM. Still not able to turn many pins on with the code blown into a real 877, but I'll work on that tomorrow (could just be the programmer).

Take Care,

George

PS- Yes I did try to read up on the ADCON register before I posted ;D. It just seems all I found were references to things which needed to be done if using the ports for analog or for inputs (thought I was safe with all outs :-[).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...