#include <xc.h>
//Configurations and Fuses
#pragma config OSC = HS, OSCS = OFF,PWRT = ON,BOR = OFF
#pragma config BORV = 45,WDT = OFF,WDTPS = 1,CCP2MUX = OFF
#pragma config STVR = OFF,LVP = OFF,DEBUG = OFF
#pragma config CP0 = OFF,CP1 = OFF,CP2 = OFF,CP3 = OFF,CPB = OFF,CPD = OFF
#pragma config WRT0 = OFF,WRT1 = OFF,WRT2 = OFF,WRT3 = OFF,WRTB = OFF,WRTC = OFF,WRTD = OFF
#pragma config EBTR0 = OFF,EBTR1 = OFF,EBTR2 = OFF,EBTR3 = OFF,EBTRB = OFF
//PORTB pins.
char array[9] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
//Timer values.
char offset[20] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
//char temp = 1;
char temp = 2;
int inside = 0;
int outside = 0;
int scanPin = 500;
void Initialization(void) {
LATA = 0x00;
LATB = 0X00;
LATC = 0X00;
LATD = 0X00;
LATE = 0X00;
TRISA = 0x00;
TRISB = 0x00;
TRISC = 0x00;
TRISD = 0x00;
TRISE = 0x00;
PORTA = 0x00;
PORTB = 0x00;
PORTC = 0x00;
PORTD = 0x00;
PORTE = 0x00;
}
void delay(void) {
//inside-- is slower
//inside++ is faster
for (inside = 0; inside > scanPin; inside++) {
for (outside = 0; outside < temp; outside++) {
// }
// for (inside = 0; inside < 5000; inside--) {
}
}
}
void main(void) {
Initialization(); //Set all device pins.
//unsigned char array[9] = {0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
while (1) {
// PORTB = offset--;
PORTD = offset[0];//array[0];
delay();
PORTD = offset[1];//array[1];
delay();
PORTD = offset[2];//array[2];
delay();
PORTD = offset[3];//array[3];
delay();
PORTD = offset[4];//array[4];
delay();
PORTD = offset[5];//array[5];
delay();
PORTD = offset[6];//array[6];
delay();
PORTD = offset[7];//array[7];
delay();
}
}
hahaha, that's what the guy behind the sales counter tried to sell me. I was not impressed.how are you seeing atmel parts as a compilation option?
I think I did do that. I am not sure if it would program to device that way. I am unable to show evidence. Please select a device in which I am able to provide code for Blinking led.You need to get back to just blinking an LED or this will get out of hand
Tom Maier wrote:You are being uncooperative, so I have to bail out here...
Users browsing this forum: No registered users and 9 guests