View previous topic :: View next topic |
Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue May 04, 2004 2:39 pm |
|
|
Most of the code in your program is completely unnecessary
for the CCS compiler. Here is a simple program which will
blink a LED on Pin B0. Try this program.
(If your crystal is a different frequency than 4 MHz, then
change the #use delay statement. If your crystal is 20 MHz,
then change the 'XT' in the #fuses statement to be 'HS',
in the program below).
Code: | #include <16F873.h>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)
//===================================
main()
{
while(1)
{
output_high(PIN_B0);
delay_ms(500);
output_low(PIN_B0);
delay_ms(500);
}
} |
|
|
|
Kasper
Joined: 14 Jan 2004 Posts: 88 Location: Aurora, Ontario, Canada
|
|
Posted: Tue May 04, 2004 2:42 pm |
|
|
try this
Code: |
#include <16F873.H>
#use delay(clock=6000000,RESTART_WDT)
void main(void) {
while(1){
output_high(PIN_B0);
delay_ms(200);
output_low(pin_B0);
delay_ms(200);
}// end while
}// end main
|
edit: beat me to it :P |
|
|
Woody
Joined: 11 Sep 2003 Posts: 83 Location: Warmenhuizen - NL
|
|
Posted: Tue May 04, 2004 3:03 pm |
|
|
Or, since the invention of the 'output_toggle' statement:
Code: |
#include <16F873.h>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)
//===================================
main()
{
while(1)
{
output_toggle(PIN_B0);
delay_ms(500);
}
} |
Paul |
|
|
adrian
Joined: 08 Sep 2003 Posts: 92 Location: Glasgow, UK
|
|
Posted: Wed May 05, 2004 5:58 am |
|
|
Woody wrote: | Or, since the invention of the 'output_toggle' statement:
Paul |
Which version did that appear in? |
|
|
Woody
Joined: 11 Sep 2003 Posts: 83 Location: Warmenhuizen - NL
|
|
Posted: Wed May 05, 2004 3:27 pm |
|
|
I am not sure. I renewed my license last week, downloaded 3.190, read the readme and there it was mentioned.
I do not have the versions between 3.152 and 3.190 so I cannot tell you when it appeared.
Paul |
|
|
Guest
|
output_toggle |
Posted: Sat Nov 13, 2004 12:18 pm |
|
|
output_toggle
I have the 3.206 version, and "output_toggle" compiles but the help didn't show me nothing about it.-
Excuse me for my english is very poor.-
I am from Argentina (Maradona).
Thanks!!!! |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1933 Location: Norman, OK
|
|
Posted: Sat Nov 13, 2004 1:25 pm |
|
|
Output_Toggle() is documented in the new manual on the download page. |
|
|
|