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

Problems with code and simple output

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







Problems with code and simple output
PostPosted: Fri Apr 18, 2003 6:02 pm     Reply with quote

I set up a very simple program to start experimenting with CCS C, but cannot get a simple LED to work. According to almost all the CCS C examples I've seen, it seems people are using the following command to turn an output on:

LED1 = ON; or LED1 = 1;

However, i am only able to get this thing to work if I use a line such as:

output_high(PIN_B2);

How do I configure the program to allow the use of the above examples such as simply writing, LED1 = ON; to enable the LED.

Here is the example program I was trying to write. If you could tell me what I'm doing wrong, I'd greatly appreciate it.
Thanks

#include <16c66.h>
#fuses XT, NOPROTECT, NOWDT, NOPUT
#use delay (clock=4000000)

#byte PORT_A = 5
#byte PORT_B = 6
#byte PORT_C = 7
#bit LED1 = PIN_B2

set_tris_b(0b11000000);

void main(void)
{
while (TRUE)
{
LED1 = 1;
}
}
___________________________
This message was ported from CCS's old forum
Original Post ID: 13797
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: Problems with code and simple output
PostPosted: Fri Apr 18, 2003 6:18 pm     Reply with quote

:=#bit LED1 = PIN_B2
:=
--------------------------------------------

The problem is in the bit statement. Try it this way:

#byte PORT_B = 6
#bit LED1 = PORT_B.2

Or, this would also work:

#bit LED1 = 6.2

___________________________
This message was ported from CCS's old forum
Original Post ID: 13798
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