Hi Henrik,
i did have the DEFINEs on the code like this.
On the first stage that i send the following command, to change the baudrate for the GPS, it works because both PIC and GPS are at the same rate.Code:'*-----------------------------------------------------------------------------| '* | --------------------- | | '*----------------------- | EUART 1 Configuration | --------------------------| '* | --------------------- | | '*-----------------------------------------------------------------------------| DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1 DEFINE HSER_CLROERR 1 ' Clear overflow automatically DEFINE HSER_SPBRG 160 ' 38400 Baud @ 64MHz, -0,08% SPBRGH = 1 BAUDCON.3 = 1 ' Enable 16 bit baudrate generator '*-----------------------------------------------------------------------------| '* | --------------------- | | '*----------------------- | EUART 2 Configuration | --------------------------| '* | --------------------- | | '*-----------------------------------------------------------------------------| 'DEFINE HSER2_RCSTA 90h ' Enable serial port & continuous receive 'DEFINE HSER2_TXSTA 24h ' Enable transmit, BRGH = 1 'DEFINE HSER2_CLROERR 1 ' Clear overflow automatically 'DEFINE HSER2_SPBRG 160 ' 38400 Baud @ 64MHz, -0,08% 'SPBRGH2 = 1 'BAUDCON2.3 = 1 ' Enable 16 bit baudrate generator DEFINE HSER2_RCSTA 90h ' Enable serial port & continuous receive DEFINE HSER2_TXSTA 24h ' Enable transmit, BRGH = 1 DEFINE HSER2_CLROERR 1 ' Clear overflow automatically DEFINE HSER2_SPBRG 130 ' 9600 Baud @ 64MHz, -0,02% SPBRGH2 = 6 BAUDCON2.3 = 1 ' Enable 16 bit baudrate generator '------------------------------------------------------------------------------| '-----------sent a sentence to gps, this is not working at the moment----------| '------------------------------------------------------------------------------| ' When the GPS Module is POWERED ON, then the following sentenses are received. ' $PMTK011,MTKGPS*08 ' $PMTK010,001*2E ' $PMTK010,002*2D pause 800 HSEROUT2 ["$PMTK251,38400*27",13,10] ' 38400 boundrate, check MTK manual configuration pause 500 RCSTA2 = $90 ' Enable serial port & continuous receive TXSTA2 = $24 ' Enable transmit, BRGH = 1 SPBRG2 = 160 ' 38400 Baud @ 64MHz, -0,08% HSEROUT2 ["$PMTK220,100*2F",13,10] ' 100(millisecond)=0.1(sec)-->1/0.1= 10Hz
then i guess with the following code that i change the rate on the PIC's port.Code:B]HSEROUT2[/B] ["$PMTK251,38400*27",13,10] ' 38400 boundrate, check MTK manual configuration
then send the command which seems that it doesnt work.Code:RCSTA2 = $90 ' Enable serial port & continuous receive TXSTA2 = $24 ' Enable transmit, BRGH = 1 SPBRG2 = 160 ' 38400 Baud @ 64MHz, -0,08%
Code:HSEROUT2 ["$PMTK220,100*2F",13,10] ' 100(millisecond)=0.1(sec)-->1/0.1= 10Hz
Bookmarks