Hi all I need help with 12c508, i am loosing it

I have a 12f508 and trying initialize it

every think works except the GP2 pin i need it to work as an out put. but it just doesnt work . I have tried everything. I think it is somthing to do with the timer0 but i dont know what.

anyways this is how i have initialized it.

#include #fuses INTRC,NOWDT,NOPROTECT,NOMCLR #use delay(clock = 4000000) #use fast_io(B) void main() { int8 turnoffdelay = shutdwn_delay_min; //shutdown delay variable int8 MainPower_off; int1 pinstatus; //stores the GP0 status int1 toggle; set_tris_B(0x29); output_B(0x00);

PLS HElp I WILL REALY APRECIATE IT Thanks Nadeem

Reply to
Nadeem
Loading thread data ...

This is not the correct newsgroup.

But anyway, you will need to set the OPTION register. See the datasheet.

Also note that the 12C508 is not the same as the 12F508 in every respect (you refer to both).

Best regards, Spehro Pefhany

Reply to
Spehro Pefhany

snipped-for-privacy@acuraembedded-dot-com.no-spam.invalid (Nadeem) wrote in news: snipped-for-privacy@corp.supernews.com:

Your main needs to end with an infinite loop

Scott

Reply to
Scott Seidman

I don't see anything in your code that sets the option register. As I recall, it defaults to use GP2 as a clock source on reset. This would make it an input pin and disregard the TRIS bits.

Mark Walsh

Reply to
Mark

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.