VladFel
#include "regs_map_C.h"
#include "reg51.h"
sbit gpioa_7 = 0x87;
volatile int i;
/*void main(void) //Receiver
{
IE = 0x84;
WriteReg(GPIOA_DIR_SET, 0x80);
gpioa_7 = 1;
WriteReg(GPIOA_ALTF1, 0x05);
WriteReg(UART0_BDR0, 0x1A); //Less significant byte of baudrate
WriteReg(UART0_BDR1, 0x00); //Most significant byte of baudrate (final baudrate is 9600)
WriteReg(UART0_MSK1, 0x01); //RBNE
WriteReg(UART0_CTRL, 0x20); //Reciever
while (1);
}
void int1_handler (void) interrupt 2 //Interrupt on receinving data
{
gpioa_7 ^= 1;
ReadReg(UART0_RX0);
WriteReg(INT_FIX_CLR1, 0x04);
}*/
void Delay(int tick);
void main(void) //Transmitter
{
IE = 0x84;
WriteReg(GPIOA_DIR_SET, 0x80);
gpioa_7 = 1;
WriteReg(GPIOA_ALTF1, 0x05);
WriteReg(UART0_BDR0, 0x1A); //Less significant byte of baudrate
WriteReg(UART0_BDR1, 0x00); //Most significant byte of baudrate (final baudrate is 9600)
WriteReg(UART0_MSK1, 0x02); //TI
WriteReg(UART0_CTRL, 0x10); //Transmitter
while (1)
{
WriteReg(UART0_TX, 0x34);
Delay(30000);
}
}
void Delay(int tick)
{
i=0;
while(i<tick)
i++;
}
void int1_handler (void) interrupt 2
{
gpioa_7 ^= 1;
WriteReg(INT_FIX_CLR1, 0x04);
}