Jump to content
Sign in to follow this  
Stringer

Port A with plug-ins

Recommended Posts

None of the plug-ins seem to work with the portA. LCD doesn't print, logic analyzer doesn't say anything, voltage meter does show zero and LED doesn't turn on. This is the case for PIC16F874/7, but if I choose PIC16F84A plug-ins work.

 

However, physical PICs do work just fine.

 

What can be done? PIC16F84A doesn't have all the ports I need.

Share this post


Link to post
Share on other sites
Guest Dave

Stringer,

 

This is not a bug!   :)

 

In devices that have ADC's (analog to digital convertors), when the device has a power on reset, the ports that are shared between analog and digital I/O are configure as analog inputs.

 

In order to use then as digital inputs or outputs you must configure the ADC port configuration bits by writing to ADCON1.

 

ie

adcon = 0x06;

will configure all of PORTA to be used for digital I/O, none for analog functions, just as you want it. :;):

 

The 16F84 does not have an ADC, so it does not need to be configured in this way.

 

How does the real device work fine ??? - this I cannot explain, but consider:

1) Maybe you powerup or device reset is not clean, so some how the ADCON1 does not have the standard power up value.

Does the device work as expected every time you power it up, or do you have to power it up several times before it works?

 

2) The device you have somehow does not function as per Microchips data sheets???

 

Please let me know if this helps and what you find.

 

Regards

Dave

;)

Share this post


Link to post
Share on other sites

Yes, the adcon1=0x6; really helps. Thanks!

 

You really should mention things like that on the manual. Is there anything else I should know about?

 

Also, the logic analyzer was configured for inputs by default after install, although the bits were set for outputs. It also crashed before I tried to modify them.

 

 

BTW. The real device was working just fine, in all cases.

Share this post


Link to post
Share on other sites
Guest Dave

Stringer,

Glad that this has resolved your issue. :)

 

You really should mention things like that on the manual.

Where this imformation appears appears is in the Microchip data sheets for the device. The simulator acts like the real device, so it does not need documenting separately.

 

Regards

Dave

Share this post


Link to post
Share on other sites
Stringer,

Glad that this has resolved your issue. :)

 

You really should mention things like that on the manual.

Where this imformation appears appears is in the Microchip data sheets for the device. The simulator acts like the real device, so it does not need documenting separately.

 

Regards

Dave

Where this imformation appears appears is in the Microchip data sheets for the device. The simulator acts like the real device, so it does not need documenting separately.

 

Yes, now that I did read the portA specification from the datasheet, there seems to be a quite big warning:

 

"Note: On a Power-on Reset, these pins are configured

as analog inputs and read as '0'."

 

Funny that I didn't notice it before ;)

 

Anyway, would it be possible to make the plug-ins (or compiler) to warn about the miss-use?

Share this post


Link to post
Share on other sites
Guest Dave

Stringer,

 

Anyway, would it be possible to make the plug-ins (or compiler) to warn about the miss-use?

This sort of thing is difficult, because knowing what the programmer intended is difficult or impossible.

 

Funny that I didn't notice it before

It is funny, can you explain how the actual device seemed to work correctly ???

 

Regards

Dave

Share this post


Link to post
Share on other sites
This sort of thing is difficult, because knowing what the programmer intended is difficult or impossible.

 

Yes, and thats why only warnings. No errors. I guess you could just use your common sense and knowledge about these things to give hints, before problems escalate to the forums.

 

Or perhaps you could update your FAQ?

 

 

It is funny, can you explain how the actual device seemed to work correctly

 

I have no idea. All my chips have always worked just fine. (874/877). I used CH Flash Basic before PicAnt and I don't find any Adcon1 init from it's assembler file either. And still, back then I used portA as following:

 

RA0/AN0	RS
RA1/AN1	RW
RA2/AN2/VREF-	Enabled
RA3/AN3/VREF+	LCDData2

Share this post


Link to post
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...
Sign in to follow this  

×
×
  • Create New...