Pheetuz
Full Member level 3
Hi folks.
I am trying to communicate from a PIC18F4520 to another PIC18F4520, however for the time being I am just trying to transmit data out of one PIC to an oscilloscope, just to ensure that I am actually transmitting which it appears I'm not.
I have to configuration bits on the PIC set up in the PIC menu, and am using a 10MHz crystal on a PICDEM2 board.
All I want to do is transmit a series of 1s and 0s which is why 0xAA is being fed into TXREG.
I have the oscilloscope triggering set up so that I would be able to see a change on the screen but nothing is happening when I load data into the TXREG.
If anyone can see anything wrong with my code it would be much appreciated.
Pete
I am trying to communicate from a PIC18F4520 to another PIC18F4520, however for the time being I am just trying to transmit data out of one PIC to an oscilloscope, just to ensure that I am actually transmitting which it appears I'm not.
I have to configuration bits on the PIC set up in the PIC menu, and am using a 10MHz crystal on a PICDEM2 board.
All I want to do is transmit a series of 1s and 0s which is why 0xAA is being fed into TXREG.
I have the oscilloscope triggering set up so that I would be able to see a change on the screen but nothing is happening when I load data into the TXREG.
If anyone can see anything wrong with my code it would be much appreciated.
Code:
#include <P18F4520.h>
#include <stdio.h>
#include <usart.h>
void main (void)
{
//CONFIGURES THE PORTS
ADCON0 = 16;
CMCON = 7;
TRISA = 255;
TRISB = 255;
TRISC = 255;
// CONFIGURES THE USART.
TXSTA = 176;
RCSTA = 128;
BAUDCON = 24;
SPBRG = 255;
SPBRGH = 255;
//TEST
TXREG = 0xAA;
while(1){}
}
Pete