PIC24 RS-232???

Create new topics, add your comment, remark, bugs...
Post Reply
dilhat
Posts: 1
Joined: Tue Nov 17, 2009 3:18 pm

PIC24 RS-232???

Post by dilhat » Tue Nov 17, 2009 3:27 pm

Hi, i'm using pic24f explorer development board and try to send data from serial port (RS232) to PC. All the configurations of terminal and COM settings are ok but i can not monitor wright character. i use the serial port monitor program for catch hex codes and generally received hex codes are like "00 00" form or different character but not sended data. trying different boudrates can not solve my problem. if you have any idea please share me.

Code: Select all

#include "p24fj128ga010.h"

#define CTS _RF12
#define RTS _RF13

#define BRATE 34

#define U_ENABLE 0x8008
#define U_TX 0x0400


void initU2(void){

U2BRG=BRATE;
U2MODE=U_ENABLE;
U2STA=U_TX;

TRISF=0xDFFF;
RTS=1;
}

int putU2(int c){
while(CTS);
while(U2STAbits.UTXBF);
U2TXREG=c;
}

char getU2(void){
RTS=0;
while(!U2STAbits.URXDA);
return U2RXREG;
RTS=1;
}

main(){
char c;

initU2();

putU2('b');

while(1){

c=getU2();

putU2(c);
}
}

LubinKerhuel
Site Admin - Expert
Posts: 616
Joined: Wed Mar 07, 2007 11:23 pm
Location: Bayonne- France
Contact:

Re: PIC24 RS-232???

Post by LubinKerhuel » Tue Nov 17, 2009 4:39 pm

Provided you have simulink, try to program your dsPIC using Simulink and this blockset : http://www.kerhuel.eu/wiki/Release_Notes
Otherwise, you would porbably get better responses on the microchip forum.

Lubin

Post Reply

Who is online

Users browsing this forum: No registered users and 43 guests