Hi,
Below is a sample code that's supposed to flash 8 LEDs on port b at 5 Hz. I
have modified the .h file to correspond to the one included in the latest
SDCC snapshot. However, I'm not sure how to change the "#pragma config..."
line to correspond to the same command in SDCC. That particular line is for
MPLAB C18 C compiler. Can someone lend me a hand on how to get started with
regards to dealing with that line?
#include <pic18f2620.h>
#pragma config WDT = OFF, OSC = INTIO67 // WDT off, int RC osc,
// RA6 & RA7 as I/O
// See 18F Config Addendum,
// p. 116
void delay(int dly)
{
while(--dly > 0)
dly = dly;
}
void main()
{
OSCCON = 0x72; // Int osc at 8 MHz
// See p. 30 of 18F2620 data sheet
ADCON1 = 0x0f; // All ports digital
// See 18F2620 data sheet, p. 94
ADCON2 = 0x05; // Set AN10-AN12 on PORTB as digital I/O
// See p. 224 of 18F2620 data sheet
TRISB = 0; // All PORTB lines as outputs
while(1)
{
PORTB = 0x55; // Flash 8 LEDs on PORTB in checkerboard pattern
delay(6500); // at approx 5 Hz
PORTB = 0xAA;
delay(6500);
}
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user