Hi.
I have some configuration problems. Could you help me out ?
I am trying to write a test softare that will echo back to my PC trought a SCI port.
I have a circuitboard allready, and the IRSCI is connected to a max232 circuit.
The ordinary SCI is reserved to another task.
Check my code below.
#include <hidef.h> /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */
void main(void) {
int b=0;
int a=0;
DisableInterrupts;
CONFIG2 = 0x01; //Internal data bus clock
DDRC&=~(0x80); //Rx pin as input
PTC|=0x40; //Tx pin idle
DDRC|=0x40; //Tx pin as output
IRSCC1=0x00;
IRSCC2=0x00;
IRSCC3=0x00;
IRSCBR=0B00110000; // (4MHz/4)/(16*13) ~ 4800baud
IRSCC1=0x40; //Enable SCI module
IRSCC2=0x0C; //Enable Transmitter and Reveiver
EnableInterrupts;
for(;
{
__RESET_WATCHDOG(); /* feeds the dog */
// A delay
for(b=0;b<100;b++) {
;
}
while((SCS1 & 0x80)==0); // Rx done ??
IRSCDR=IRSCDR; // Tx the character that is Rx.
} /* loop forever */
}
What do i wrong ?
/Alfa Master