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 CCS Technical Support

Error identifier and/or declaration for PORT_X_PULLUPS

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



Joined: 21 Sep 2010
Posts: 159

View user's profile Send private message

PostPosted: Thu Mar 21, 2013 1:00 pm     Reply with quote

Why this function is not working?
Code:
...
#byte OPTION = 0b10011111
void main()
{
...

is not the same as the top function?
On compiler I do not have error's
thank you
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 21, 2013 1:53 pm     Reply with quote

Read the CCS manual on the #byte statement. Read the PIC data sheet
on how to access the OPTION register for your PIC.

Don't expect us to do these things for you, when you could do it yourself.
The answers you want are in the CCS manual and PIC data sheet.
jeremiah



Joined: 20 Jul 2010
Posts: 1349

View user's profile Send private message

PostPosted: Thu Mar 21, 2013 1:56 pm     Reply with quote

#byte specifies a location, not a value (like you are trying to do). To access the option register on this chip, you cannot use #byte as it has no known location. You need to use the assembly command OPTION, so you need to look at the data sheet for examples on that. Then in the compiler manual help, look for #asm and #endasm for how to use those.

EDIT: PCM Programmer beat me to it!
nailuy



Joined: 21 Sep 2010
Posts: 159

View user's profile Send private message

PostPosted: Thu Mar 21, 2013 11:19 pm     Reply with quote

jeremiah
Thank you for your information.
I understand now.

PCM programmer
Thanks, what I need your experience to understand some problems for me.
example of jeremiah is best for me.

Thank you guys.
Nailuy.
Ttelmah



Joined: 11 Mar 2010
Posts: 19518

View user's profile Send private message

PostPosted: Fri Mar 22, 2013 3:32 am     Reply with quote

Lets make something clear here, you don't need to fiddle with assembler.

The option register on these chips, is accessed via the setup_wdt function in CCS.
The code to enable them if required, is simply:

Code:

void main(void) {
   setup_wdt(0);

}

which generates:
Code:

0003:  CLRF   07
0004:  CLRF   01
0005:  MOVLW  0F
0006:  OPTION
0007:  CLRWDT
0008:  MOVF   07,W
0009:  OPTION


Doing the required assembler to turn this on.

The reason there is not an 'option' to turn them on in CCS, is that the bit is negative logic, with a '1' turning this off. As soon as you program the timer/watchdog prescaler they are turned _on_ unless you add the option:
DISABLE_PULLUPS

The same applies for pin change from sleep.

As a further comment though, these are foul little chips. Why not get something like the PIC12F1501, which is cheaper now, especially in bulk, and has so many more resources. Makes life a lot easier....

Best Wishes
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