CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

12f629 problem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
John77
Guest







12f629 problem
PostPosted: Mon May 02, 2005 7:26 am     Reply with quote

after trying for two days to handle with 12f629 i've became quite
frustrated.
i used all hints and code examples found in previous posts - nothing
works .
my compiler version 3.19.
programmers : ic-prog and WinPicProg.
any help would be appreciated.
p.s with 16f73 compiler works fine.
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Mon May 02, 2005 8:02 am     Reply with quote

Probably not what you want to hear, but please post short code example. COMPLETE example, #includes, #fuse, #use delay statements, etc., in other words, everything!

Also, if your compiler is reporting some errors, please list them.

Just something simple like toggle a GP I/O pin using internal oscillator only.

For example:
Code:
#include <12F629.h>
#fuses NOWDT,INTRC_IO, NOCPD, NOPROTECT, MCLR, PUT, BROWNOUT
#use delay(clock=4000000)

void main()
{
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
   
   while(1)
   {
      output_toggle(PIN_A0);
      delay_ms(100);
      output_toggle(PIN_A1);
      delay_ms(100);
   }
}


A quick check on my equipment and it worked just fine. Used V3.223 of PCW and PicKit1 to program part. Can't quite duplicate your setup since I don't keep all the old compilers installed on this machine.
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
Guest








PostPosted: Mon May 02, 2005 11:34 am     Reply with quote

my code : (no compiles's errors)
#include <12F629.h>
#fuses INTRC_IO,PUT,NOWDT,NOPROTECT,NOMCLR, NOBROWNOUT
#use delay(clock = 4000000)


#byte CMCON = 0x19
#byte TRISIO = 0x85
#byte GPIO = 0x05

void main()
{

CMCON = 7; // Comparators off
TRISIO = 0b11111110; //0xFE;
GPIO = 0;

while(true)
{
output_high(PIN_A0);
delay_ms(1000);
output_low(PIN_A0);
}

}
sseidman



Joined: 14 Mar 2005
Posts: 159

View user's profile Send private message

PostPosted: Mon May 02, 2005 12:07 pm     Reply with quote

Anonymous wrote:


while(true)
{
output_high(PIN_A0);
delay_ms(1000);
output_low(PIN_A0);
}

}


There is no delay here between "output_low" and the "output_high" at the beginning the the next loop iteration. My guess would be that you're seeing the output never go low. In fact, it will go low for only a couple of instruction cycles, then go high again. Add a second delay after the output_low

Scott
Guest








PostPosted: Mon May 02, 2005 12:32 pm     Reply with quote

the problem is that it never goes high.
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Mon May 02, 2005 12:44 pm     Reply with quote

It may be going high the one time but because of the read-write-modify issue with PIC's I/O pins you might not be seeing it return high at the pin while internally it is writing a "1" to the register. What are you using to test the pin, DMM, scope, what? What kind of load do you have the pin driving?

Just for the heck of it, add a NOP (delay_cycles(1); will do it) after the output_low() and before the closing brace.

The overhead of the while loop may be sufficient but check to datasheet with reguard to the read-write-modify conditions. Should be discussed in the I/O pin description section.

Also, since you are setting the TRIS register yourself, you can add "#use fast_io(A)" to the beginning of your program.

And one last thing, check the LST file after you compile. It may be that your version of the compiler is doing something silly. I don't think I have V3.190 on my drive to test with.
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon May 02, 2005 1:23 pm     Reply with quote

Quote:
my compiler version 3.19.

What's your exact compiler version ? 3.190 or 3.191 ?

Quote:
programmers : ic-prog and WinPicProg.

Do you guarantee that your version of ic-prog will program the 12F629 ?
Guest








PostPosted: Mon May 02, 2005 1:49 pm     Reply with quote

I changed the code :
while(true)
{
output_high(PIN_A0);
delay_ms(1000);
output_low(PIN_A0);
delay_ms(1000); // one more delay

}
it didn't help. scope indicates no signal on pin.
compiler version 3.190.
those programmers are reliable - code compiled in other compilers
for the same 12f629 was programmed and runs ok.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon May 02, 2005 2:09 pm     Reply with quote

I took your program that you posted above, suitably fixed as shown
in your later post with the additional delay_ms(1000) statement,
compiled it with vs. 3.190, and programmed it with a PicStart-Plus.
It works.

Maybe you clobbered the OSCCAL value at address 0x3FF.
Read the PIC's program memory with your programmer and
look at the value at the end of ROM. My PIC has got 0x34A8 there.
It should have a value in this format: 0x34xx

If it the value there is 0x3FFF, then you've erased the OSCCAL value.
Then the program won't run properly. The PIC will appear to be dead.
Guest








PostPosted: Mon May 02, 2005 2:22 pm     Reply with quote

thank you for your concern . i'll look deeper into OSCCAL issue.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group