piclist 2001\07\26\183545a >
Thread: CCS C Example
www.piclist.com/techref/microchip/languages.htm?key=c
flavicon
face BY : Mike Mansheim email (remove spam text)



> Could somebody send me an example of a (simple)working CCS C source
> program for a F84 (RS232 maybe)...
> ...but can't seem to get anything working with CCS C.

Well, I've got lots of working CCS C programs, but none for the F84 or
with RS232.  You're welcome to send me (direct) what you've got that
isn't working, and I can tell you if it's something obvious.
Also, is it a problem with the development environment, or getting the
program to compile, or getting a compiled program to run properly,
or ???
Let me know if you would like to see something more complex, but
here's a real simple program that will blink an led attached to RC7,
for a chip (16F876) and crystal (10M) I've used:

5V --> led --> 750 ohm --> RC7

#case     // makes compiler case sensitive
#include "c:\picc\examples\16F876.h"

// set configuration bits:
#fuses HS, NOWDT, PUT, NOPROTECT, BROWNOUT, NOLVP, NOCPD, WRT

#byte PORTA = 0x05
#byte PORTB = 0x06
#byte PORTC = 0x07

#bit LED = PORTC.7

void INITIALIZE(void);           // prototype

#use delay(clock = 10000000)     // 10M clock

void main(void)
{
   INITIALIZE();

   while(1)
   {
       if (LED) LED = 0;
       else     LED = 1;
       delay_ms(500);
   }
}

void INITIALIZE(void)
{
   // set RC7 as output (and high)
   // since rest are unknown, set as outputs (and low)

   setup_adc_ports(NO_ANALOGS);
   PORTA = 0;
   set_tris_a(0);

   PORTB = 0;
   set_tris_b(0);

   PORTC = 0b10000000;       // init LED off
   set_tris_c(0);
}

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


<OF62F51CC7.45AF6C8F-ON86256A95.0078AA94@graco.com>

See also: www.piclist.com/techref/microchip/languages.htm?key=c
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) CCS C Example

month overview.

new search...