![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
liche Guest
|
Problems with code and simple output |
Posted: Fri Apr 18, 2003 6:02 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
Re: Problems with code and simple output |
Posted: Fri Apr 18, 2003 6:18 pm |
|
|
:=#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 |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|