CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

RS232 problem on PIC16f73

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
R Bhaskaran
Guest







RS232 problem on PIC16f73
PostPosted: Thu Mar 27, 2003 3:49 am     Reply with quote

HI,
I am a newbie with CCS. I have a simple appln on PIC16F73 to communicate with a PC, using rs232(8N1 signal). Have a tested HW with MAX233 and 4MH crystal.
I used the project wizard of (PCW - 3.24) and have a simple code sending chars to the serial port, as follows...
/***********************************************************/
#include <16F73.h>
#use delay(clock=4000000)
#fuses XT,PUT,BROWNOUT,NOWDT
#use rs232(baud=2400,parity=N,xmit=PIN_C6,rcv=PIN_C7)

static int fCount, fFlag;

main(){

while(1){
putc('G');
putc('\r');
/* this is buzzer for TESTINg the main loop */
fCount= (fCount+1)\%20;
if(fCount==0){
if(fFlag==0){
output_bit(PIN_A2,1);
fFlag =1;
}
else{
output_bit(PIN_A2,0);
fFlag = 0;
}
}

}
}
/***********************************************************/
The main loop is working as the buzzer is beeping. But the QBASIC program that try to read the chars sent by the PIC only shows an I/O ERROR !!

I tried
#use rs232(baud=2400,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=9)
#use rs232(baud=2400,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
also, but nothing seems to be working.

Can anybody help me to fix this?
Thanks,

R Bhaskar
___________________________
This message was ported from CCS's old forum
Original Post ID: 13126
Sherpa Doug
Guest







Re: RS232 problem on PIC16f73
PostPosted: Thu Mar 27, 2003 8:49 am     Reply with quote

It sounds like a QBASIC problem. Can you try looking at the data comming into the PC with PROCOM, or SIOW that comes from CCS, or any other standard terminal program? Is there any way to get more info from QBASIC about what type of IO error? Can you look at the serial line with a scope and verify the serial bits out of the PIC?
SherpaDoug

:=HI,
:=I am a newbie with CCS. I have a simple appln on PIC16F73 to communicate with a PC, using rs232(8N1 signal). Have a tested HW with MAX233 and 4MH crystal.
:=I used the project wizard of (PCW - 3.24) and have a simple code sending chars to the serial port, as follows...
:=/***********************************************************/
:=#include <16F73.h>
:=#use delay(clock=4000000)
:=#fuses XT,PUT,BROWNOUT,NOWDT
:=#use rs232(baud=2400,parity=N,xmit=PIN_C6,rcv=PIN_C7)
:=
:=static int fCount, fFlag;
:=
:=main(){
:=
:= while(1){
:= putc('G');
:= putc('\r');
:= /* this is buzzer for TESTINg the main loop */
:= fCount= (fCount+1)\%20;
:= if(fCount==0){
:= if(fFlag==0){
:= output_bit(PIN_A2,1);
:= fFlag =1;
:= }
:= else{
:= output_bit(PIN_A2,0);
:= fFlag = 0;
:= }
:= }
:=
:= }
:=}
:=/***********************************************************/
:=The main loop is working as the buzzer is beeping. But the QBASIC program that try to read the chars sent by the PIC only shows an I/O ERROR !!
:=
:=I tried
:=#use rs232(baud=2400,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=9)
:=#use rs232(baud=2400,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
:=also, but nothing seems to be working.
:=
:=Can anybody help me to fix this?
:=Thanks,
:=
:=R Bhaskar
___________________________
This message was ported from CCS's old forum
Original Post ID: 13136
Jonko
Guest







Re: RS232 problem on PIC16f73
PostPosted: Thu Mar 27, 2003 1:24 pm     Reply with quote

Try configuring the TRISC register...

I'm running a 16F876 @ 4 Mhz with a MAX232, computer serial port configured as 19200bps 8N1, and no problems.

Try with a terminal emulator program to test RS232 connection (i.e. HyperTerminal)

;)


:=It sounds like a QBASIC problem. Can you try looking at the data comming into the PC with PROCOM, or SIOW that comes from CCS, or any other standard terminal program? Is there any way to get more info from QBASIC about what type of IO error? Can you look at the serial line with a scope and verify the serial bits out of the PIC?
:=SherpaDoug
:=
:=:=HI,
:=:=I am a newbie with CCS. I have a simple appln on PIC16F73 to communicate with a PC, using rs232(8N1 signal). Have a tested HW with MAX233 and 4MH crystal.
:=:=I used the project wizard of (PCW - 3.24) and have a simple code sending chars to the serial port, as follows...
:=:=/***********************************************************/
:=:=#include <16F73.h>
:=:=#use delay(clock=4000000)
:=:=#fuses XT,PUT,BROWNOUT,NOWDT
:=:=#use rs232(baud=2400,parity=N,xmit=PIN_C6,rcv=PIN_C7)
:=:=
:=:=static int fCount, fFlag;
:=:=
:=:=main(){
:=:=
:=:= while(1){
:=:= putc('G');
:=:= putc('\r');
:=:= /* this is buzzer for TESTINg the main loop */
:=:= fCount= (fCount+1)\%20;
:=:= if(fCount==0){
:=:= if(fFlag==0){
:=:= output_bit(PIN_A2,1);
:=:= fFlag =1;
:=:= }
:=:= else{
:=:= output_bit(PIN_A2,0);
:=:= fFlag = 0;
:=:= }
:=:= }
:=:=
:=:= }
:=:=}
:=:=/***********************************************************/
:=:=The main loop is working as the buzzer is beeping. But the QBASIC program that try to read the chars sent by the PIC only shows an I/O ERROR !!
:=:=
:=:=I tried
:=:=#use rs232(baud=2400,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=9)
:=:=#use rs232(baud=2400,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
:=:=also, but nothing seems to be working.
:=:=
:=:=Can anybody help me to fix this?
:=:=Thanks,
:=:=
:=:=R Bhaskar
___________________________
This message was ported from CCS's old forum
Original Post ID: 13156
R Bhaskaran
Guest







Re: RS232 problem on PIC16f73
PostPosted: Thu Mar 27, 2003 10:49 pm     Reply with quote

Thank You very much. I will try out and will come back if could not fix.
RB

:=Try configuring the TRISC register...
:=
:=I'm running a 16F876 @ 4 Mhz with a MAX232, computer serial port configured as 19200bps 8N1, and no problems.
:=
:=Try with a terminal emulator program to test RS232 connection (i.e. HyperTerminal)
:=
:=;)
:=
:=
:=:=It sounds like a QBASIC problem. Can you try looking at the data comming into the PC with PROCOM, or SIOW that comes from CCS, or any other standard terminal program? Is there any way to get more info from QBASIC about what type of IO error? Can you look at the serial line with a scope and verify the serial bits out of the PIC?
:=:=SherpaDoug
:=:=
:=:=:=HI,
:=:=:=I am a newbie with CCS. I have a simple appln on PIC16F73 to communicate with a PC, using rs232(8N1 signal). Have a tested HW with MAX233 and 4MH crystal.
:=:=:=I used the project wizard of (PCW - 3.24) and have a simple code sending chars to the serial port, as follows...
:=:=:=/***********************************************************/
:=:=:=#include <16F73.h>
:=:=:=#use delay(clock=4000000)
:=:=:=#fuses XT,PUT,BROWNOUT,NOWDT
:=:=:=#use rs232(baud=2400,parity=N,xmit=PIN_C6,rcv=PIN_C7)
:=:=:=
:=:=:=static int fCount, fFlag;
:=:=:=
:=:=:=main(){
:=:=:=
:=:=:= while(1){
:=:=:= putc('G');
:=:=:= putc('\r');
:=:=:= /* this is buzzer for TESTINg the main loop */
:=:=:= fCount= (fCount+1)\%20;
:=:=:= if(fCount==0){
:=:=:= if(fFlag==0){
:=:=:= output_bit(PIN_A2,1);
:=:=:= fFlag =1;
:=:=:= }
:=:=:= else{
:=:=:= output_bit(PIN_A2,0);
:=:=:= fFlag = 0;
:=:=:= }
:=:=:= }
:=:=:=
:=:=:= }
:=:=:=}
:=:=:=/***********************************************************/
:=:=:=The main loop is working as the buzzer is beeping. But the QBASIC program that try to read the chars sent by the PIC only shows an I/O ERROR !!
:=:=:=
:=:=:=I tried
:=:=:=#use rs232(baud=2400,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=9)
:=:=:=#use rs232(baud=2400,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
:=:=:=also, but nothing seems to be working.
:=:=:=
:=:=:=Can anybody help me to fix this?
:=:=:=Thanks,
:=:=:=
:=:=:=R Bhaskar
___________________________
This message was ported from CCS's old forum
Original Post ID: 13174
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group