hexreader
Advanced Member level 2
- Joined
- Apr 7, 2011
- Messages
- 550
- Helped
- 196
- Reputation
- 396
- Reaction score
- 197
- Trophy points
- 1,323
- Location
- England
- Activity points
- 6,040
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
I wrote pintest in mikroC pro, so it will not be of use to you.do you have the c file for the first pintest trial ?
// C test program for PICDEM2 plus green with PIC18F4520 and 10MHz xtal
#include <p18cxxx.h>
// prototypes
void delays(unsigned int seconds);
//#pragma config OSC = HSPLL // 10MHz xtal x4 = 40MHz
//#pragma config OSC = HS
#pragma config OSC = INTIO67 // internal oscillator
#pragma config FCMEN = OFF // Fail-Safe Clock Monitor disabled
#pragma config IESO = OFF // Oscillator Switchover mode disabled
#pragma config PWRT = ON // power up timer enabled
#pragma config BOREN = SBORDIS // Brown-out Reset enabled in hardware only (SBOREN is disabled)
#pragma config WDT = OFF // WDT disabled
#pragma config MCLRE = ON // MCLR pin enabled; RE3 input pin disabled
#pragma config LPT1OSC = OFF // Timer1 configured for higher power operation
#pragma config PBADEN = OFF // PORTB<4:0> pins are configured as digital I/O on Reset
#pragma config CCP2MX = PORTC // CCP2 input/output is multiplexed with RC1
#pragma config STVREN = ON // Stack full/underflow will cause Reset
#pragma config LVP = OFF // Single-Supply ICSP disabled
#pragma config XINST = OFF // Instruction set extension and Indexed Addressing mode disabled
// code protect - don't care
void main(void)
{
TRISA = 0x00; // all output
TRISB = 0x00; // all output
TRISC = 0x00; // all output
TRISD = 0x00; // all output
TRISE = 0x00; // all output
LATA = 0xFF; // LED on, to show life
LATB = 0xFF; // LED on, to show life
LATC = 0xFF; // LED on, to show life
LATD = 0xFF; // LED on, to show life
LATE = 0xFF; // LED on, to show life
while(1) // loop forever at end to prevent reset
{
LATA = 0x55; // pattern 1
LATB = 0x55; // pattern 1
LATC = 0x55; // pattern 1
LATD = 0x55; // pattern 1
LATE = 0x55; // pattern 1
delays(1); // time to see LEDs
LATA = 0xaa; // pattern 2
LATB = 0xaa; // pattern 2
LATC = 0xaa; // pattern 2
LATD = 0xaa; // pattern 2
LATE = 0xaa; // pattern 2
delays(1); // time to see LEDs
}
}
// delay for n seconds
void delays(unsigned int seconds)
{
unsigned long l,m,n;
for( n = 0 ; n < seconds ; n++)
{
for( m = 0 ; m < 5 ; m++)
{
for( l = 0 ; l < 200 ; l++);
}
}
}
Much the same thing as p18F4520.h, but a generic file that chooses the the correct processor file for you.sorry but what does this mean ? #include <p18cxxx.h> what is cxxx?
// C test program for PICDEM2 plus green with PIC18F4520 and 10MHz xtal
#include <p18cxxx.h>
// prototypes
void delays(unsigned int seconds);
//#pragma config OSC = HSPLL // 10MHz xtal x4 = 40MHz
//#pragma config OSC = HS
#pragma config OSC = INTIO67 // internal oscillator
#pragma config FCMEN = OFF // Fail-Safe Clock Monitor disabled
#pragma config IESO = OFF // Oscillator Switchover mode disabled
#pragma config PWRT = ON // power up timer enabled
#pragma config BOREN = SBORDIS // Brown-out Reset enabled in hardware only (SBOREN is disabled)
#pragma config WDT = OFF // WDT disabled
#pragma config MCLRE = ON // MCLR pin enabled; RE3 input pin disabled
#pragma config LPT1OSC = OFF // Timer1 configured for higher power operation
#pragma config PBADEN = OFF // PORTB<4:0> pins are configured as digital I/O on Reset
#pragma config CCP2MX = PORTC // CCP2 input/output is multiplexed with RC1
#pragma config STVREN = ON // Stack full/underflow will cause Reset
#pragma config LVP = OFF // Single-Supply ICSP disabled
#pragma config XINST = OFF // Instruction set extension and Indexed Addressing mode disabled
// code protect - don't care
void main(void)
{
TRISA = 0x00; // all output
TRISB = 0x00; // all output
TRISC = 0x00; // all output
TRISD = 0x00; // all output
TRISE = 0x00; // all output
LATA = 0xFF; // LED on, to show life
LATB = 0xFF; // LED on, to show life
LATC = 0xFF; // LED on, to show life
LATD = 0xFF; // LED on, to show life
LATE = 0xFF; // LED on, to show life
while(1) // loop forever at end to prevent reset
{
LATA = 0x55; // pattern 1
LATB = 0x55; // pattern 1
LATC = 0x55; // pattern 1
LATD = 0x55; // pattern 1
LATE = 0x55; // pattern 1
delays(1); // time to see LEDs
LATA = 0xaa; // pattern 2
LATB = 0xaa; // pattern 2
LATC = 0xaa; // pattern 2
LATD = 0xaa; // pattern 2
LATE = 0xaa; // pattern 2
delays(1); // time to see LEDs
}
}
// delay for n seconds
void delays(unsigned int seconds)
{
unsigned long l,m,n;
for( n = 0 ; n < seconds ; n++)
{
for( m = 0 ; m < 5 ; m++)
{
for( l = 0 ; l < 200 ; l++);
}
}
}