![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
Evan Guest
|
RS232 problem (not receive the data from the computer) |
Posted: Mon Nov 12, 2007 1:08 am |
|
|
hell All:
I have an 18f4550 and MAX3232CPE chip that i am using to communicate with a computer (hyperterminal).
RS232_PIN_2 ----PIN7_MAX3232_PIN10---------PIN_A3_18f4550
RS232_PIN_3 ----PIN8_MAX3232_PIN9---------PIN_A2_18f4550
sending data to the computer using printf==>OK
But not receive the data from the computer
#include <18F4550.h>
#fuses hs,NOWDT,PROTECT,NOLVP,NODEBUG,MCLR,NOVREGEN
#use delay (clock=8000000)
#use rs232(baud=9600,parity=N, xmit=PIN_A3,rcv=PIN_A2,bits=8)
/////////////////////////////////////////////////////////////
void main(void){
char c;
printf("\r\n\RS-232 int is ok \r\n\n"); // have display ,is ok
while(TRUE){
c = getc(); //have problem!!!
putc(c); //no display is NG
printf("\r\nSize: %u Bytes\r\n",c); //no display is NG
}
} |
|
![](templates/subSilver/images/spacer.gif) |
Evan Guest
|
Re: RS232 problem (not receive the data from the computer) |
Posted: Mon Nov 12, 2007 1:11 am |
|
|
Evan wrote: | hell All:
I have an 18f4550 and MAX3232CPE chip that i am using to communicate with a computer (hyperterminal).
RS232_PIN_2 ----PIN7_MAX3232_PIN10---------PIN_A3_18f4550
RS232_PIN_3 ----PIN8_MAX3232_PIN9---------PIN_A2_18f4550
sending data to the computer using printf==>OK
But not receive the data from the computer
Version 4.057
#include <18F4550.h>
#fuses hs,NOWDT,PROTECT,NOLVP,NODEBUG,MCLR,NOVREGEN
#use delay (clock=8000000)
#use rs232(baud=9600,parity=N, xmit=PIN_A3,rcv=PIN_A2,bits=8)
/////////////////////////////////////////////////////////////
void main(void){
char c;
printf("\r\n\RS-232 int is ok \r\n\n"); // have display ,is ok
while(TRUE){
c = getc(); //have problem!!!
putc(c); //no display is NG
printf("\r\nSize: %u Bytes\r\n",c); //no display is NG
}
} |
|
|
![](templates/subSilver/images/spacer.gif) |
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Mon Nov 12, 2007 4:31 am |
|
|
In the PIC processor the I/O pins are multiplexed for use by several hardware functions. On program startup you have to configure the I/O pins for the hardware function that you want to use. Check the datasheet of the PIC18F4550, Table 10-1 for pin A2: Quote: | PORTA<2> data input. Disabled when analog functions enabled; |
By default PIN_A2 is configured as an analog input, if you want to use it as a digital input you have to disable the analog port: Code: | setup_adc_ports(NO_ANALOGS); |
Just wondering: Why are you not using the hardware UART on pins C6 and C7? |
|
![](templates/subSilver/images/spacer.gif) |
Evan Guest
|
Now is the same question |
Posted: Mon Nov 12, 2007 6:32 pm |
|
|
Hi ckielstra
Now is the same question =>not receive the data from the computer.
Im using the hardware SPI on pins C7,B0,B1 Connection SD CARD .
Thanks for your reply.
Evan |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|