Jump to content

Finger Trouble On Pic16f676?


Recommended Posts

Hi guys,

 

Most `can't get the device working right' problems are user error, but right now I'm stumped on this one. Try as I might, I can't get RA4 to be an output on the PicAntIDE simulation. (I'll try a real chip just as soon as I have hardware).

 

These are the bits I think are related:

 

--------8<----------------------------------------------------------------

#pragma DATA _CONFIG, _PWRTE_OFF & _WDT_ON & _CP_OFF & _INTRC_OSC_NOCLKOUT

 

option_reg = 0x5F;

 

ansel = 0x00; // no analogue

cmcon = 0x07; // no comparator

 

// IO ports setup

trisa = 0x29; // Port RA0, MCLR and RA5 are inputs

porta = 0x00; // All low (pump off, SEG_A On).

trisc = 0x00; // Port C is all outputs.

portc = 0x00; // All SEGs On.

 

t1con = 0x03; // Counter; no prescaler

 

set_bit(porta, 4) // RA4 won't work??

--------8<----------------------------------------------------------------

 

I believe this should turn off the T1 clock and osc2 stuff, but the port remains resolutely low.

 

As I have a spare pin (Yay!!), I can hack the hardware, so I'm OK, but I'm beginning to wonder if this is a simulation problem. Anyone else seen the problem or my deliberate error?

 

It'll be a day or so before I have hardware to try this on.

 

G.

Link to comment
Share on other sites

Gordon,

 

Most `can't get the device working right' problems are user error, but right now I'm stumped on this one. Try as I might, I can't get RA4 to be an output on the PicAntIDE simulation. (I'll try a real chip just as soon as I have hardware).
This is a classic problem, the simulator is working just like the hardware. Check you data sheet and you will see that RA4 is a sinking only output, it can't drive high.

 

What you need is a pullup resistor, problem is we don't have one you can connect in the simulator, no one has written a pullup plugin.

 

Regards

Dave

Link to comment
Share on other sites

Gordon,

 

Most `can't get the device working right' problems are user error, but right now I'm stumped on this one. Try as I might, I can't get RA4 to be an output on the PicAntIDE simulation. (I'll try a real chip just as soon as I have hardware).
This is a classic problem, the simulator is working just like the hardware. Check you data sheet and you will see that RA4 is a sinking only output, it can't drive high.

 

What you need is a pullup resistor, problem is we don't have one you can connect in the simulator, no one has written a pullup plugin.

 

Regards

Dave

 

Hi Dave,

 

Thanks for the information, but...

 

I now have my hardware and RA4 drives high just fine.

I just checked it after reading your message in case it was marginal and it was luck that it operates the mosfet to which it's connected. No, it's a good, solid high, though I haven't yet tried to load it with anything much. My datasheet just describes the output as CMOS, which could be vague, though I think 'complementary' _should_ mean that there's an active pull-up.

 

Could there have been an error on Microchip's earlier data that's now corrected?

 

Either way, there are so many members of the PIC family that it's extraordinary that you manage to handle them at all, never mind so well.

 

Thanks,

Gordon.

Link to comment
Share on other sites

I found this in the pic midrange manual:

 

"The RA4 pin is a Schmitt Trigger input and an open drain output. All other RA port pins have TTL

input levels and full CMOS output drivers."

 

http://ww1.microchip.com/downloads/en/DeviceDoc/31009a.pdf

 

This is not true for pic16f676. From the datasheet:

RA4 TTL CMOS  Bi-directional I/O w/ programmable pull-up
Link to comment
Share on other sites

"This is not true for pic16f676. From the datasheet:

 

""RA4 TTL CMOS Bi-directional I/O w/ programmable pull-up""

 

I can't find it in the datasheet, what datasheet are u using and at what page?

I'm using the datasheet 40039c.pdf from Microchip.

Link to comment
Share on other sites

teunizz (and all)

 

This is not true for pic16f676. From the datasheet:

 

""RA4 TTL CMOS Bi-directional I/O w/ programmable pull-up""

You are quite correct, on most devices RA4 is a sinking only port, but on the 16F676 it is a push pull.

 

I'll add this one to the list to be fixed in the simulator.

 

Regards

Dave

Link to comment
Share on other sites

  • 1 year later...
teunizz (and all)

 

This is not true for pic16f676. From the datasheet:

 

""RA4 TTL CMOS Bi-directional I/O w/ programmable pull-up""

You are quite correct, on most devices RA4 is a sinking only port, but on the 16F676 it is a push pull.

 

I'll add this one to the list to be fixed in the simulator.

 

Regards

Dave

 

Am I right in thinking that this problem is still extant in V6.55?

 

G.

Link to comment
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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...