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

PIC12F629 Doesn't work as expected.

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



Joined: 14 May 2011
Posts: 26

View user's profile Send private message

PIC12F629 Doesn't work as expected.
PostPosted: Wed May 18, 2011 10:30 pm     Reply with quote

Hi fellas,

I am using 4.093 version of ccs. I have been working with 16F84A, but today decided to play with 12F629. Here is the simple code I am trying to run:

Code:
#include <12F629.H>
#fuses INTRC, BANDGAP_lOW, MCLR
#use delay (clock = 4000000)

void main() {
   set_tris_a(0x0);
   output_high(PIN_A3);
}


For some reason PIC simulator doesn't get far, only 5 instructions ahead and doesn't seem to turn on the LED.

I am sure I am missing some directive or something. Please guide me if some one knows. Thanks much all!

PS. What us up with a bandgap? I've never had to deal with that in 16f84a. Thanks!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed May 18, 2011 10:45 pm     Reply with quote

Pin A3 is the MCLR pin. Use pin A2 and try this sample program instead:
http://www.ccsinfo.com/forum/viewtopic.php?t=38261&start=1
Put a 10K pullup resistor on pin A3.
vladtess



Joined: 14 May 2011
Posts: 26

View user's profile Send private message

PostPosted: Wed May 18, 2011 11:04 pm     Reply with quote

I've copied your code into the compiler and added a pull up resistor. The thing is that the simulator still stops on the 5th instruction. I use PIC simulator IDE. Maybe I should use something else?

And as I said, I have a bandgap problems, programmer sometimes complaining that "The bandgap value of the pic is ... 0x03. Use value on buffer 0x00"

Thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed May 18, 2011 11:26 pm     Reply with quote

Quote:
I use PIC simulator IDE.

What is that ? Do you mean MPLAB simulator ?
vladtess



Joined: 14 May 2011
Posts: 26

View user's profile Send private message

PostPosted: Thu May 19, 2011 12:20 am     Reply with quote

Its: http://www.oshonsoft.com/pic.html

Should I not use it?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu May 19, 2011 12:53 am     Reply with quote

Quote:
The thing is that the simulator still stops on the 5th instruction.

The Oshonsoft simulator may not know that there is supposed to be
an OSCCAL value programmed at the last ROM address in the 12F629.
As a work-around, you can place a typical value at that address with
a #rom statement. Add the #rom line shown below to your program
(in that exact location). See if it now works.
Code:

#include <12F629.h>
#fuses INTRC_IO, NOWDT, NOMCLR, PUT, BROWNOUT
#use delay(clock=4000000)

#rom 0x3FF = {0x3480}

//==========================
void main()
{

while(1)
   {
    output_high(PIN_A2);
    delay_ms(500);
    output_low(PIN_A2);
    delay_ms(500);
   }

}
Ttelmah



Joined: 11 Mar 2010
Posts: 19339

View user's profile Send private message

PostPosted: Thu May 19, 2011 2:34 am     Reply with quote

Add the caveat - use this for simulation only, don't write this to the chip (unless you have already destroyed the OSCCAL value). The value at this location is programmed 'at the factory'.

Best Wishes
vladtess



Joined: 14 May 2011
Posts: 26

View user's profile Send private message

PostPosted: Thu May 19, 2011 9:16 am     Reply with quote

OK, thanks you guys I'll try this out when I get home! Smile
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