I just keep getting 0 bytes and I do not know why. I am using a ChipKit uC32 board and I have a Sparkfun RS232 Shifter connected to my computer. I have RX from the Shifter wired to TX on the uC32 and TX wired to RX. and I see the light blinking for RX but it is not working. When I use HyperTerminal, I connect to Com8( and I check and that is the right comport) . I checked Device Manager, and the comport is set to 8 and Data bits is 8, Parity is None, Flow control is None, and Stop bits is 1. and I set HyperTerminal so the same thing. ok here is my code:
floatAcceptable_Water_Range;/* * */int main(int argc,char** argv){Acceptable_Water_Range=1; WCM_Range ='0';intFPb=80000000;// peripheral bus clock frequency set at max SYSCLKint desired_baud =19200;unsignedint BRG =(FPb/2/ desired_baud)-2;TRISBbits.TRISB0 =0;//set portB pin to outputTRISBbits.TRISB2 =0;//set portB pin to outputTRISDbits.TRISD9 =0;//set portB pin to output//OSCConfig( OSC_POSC, OSC_PLL_MULT_24, OSC_PLL_POST_256, OSC_FRC_POST_64 );//OSCSetPBDIV( OSC_PB_DIV_8 );OpenUART1(UART_EN| UART_NO_PAR_8BIT | UART_1STOPBIT , UART_RX_ENABLE|UART_TX_ENABLE,(FPb/16/desired_baud)-1);//OpenUART2(UART_EN| UART_NO_PAR_8BIT | UART_BRGH_SIXTEEN , UART_RX_ENABLE|UART_TX_ENABLE, (FPb / (16*desired_baud) - 1 ));SpiChnOpen(1, SPI_CON_MSTEN | SPI_CON_MODE8 | SPI_CON_ON, BRG);OpenSPI1( MASTER_ENABLE_ON|SPI_MODE32_ON,SPI_ENABLE);SetUP_AtoD();turn_On_LED1(); CS =1;while(BusyUART1()); putsUART1("******** Main Menu ******** \r\n");Write_Usart("************************** \r\n");Write_Usart("****Flow Computer********* \r\n");while(1){Write_Usart("******** Main Menu ******** \r\n");Write_Usart("1) Set-up \r\n");Write_Usart("2) Run \r\n");char temp ='1';// read_Usart(1);switch( temp){case1: configuration_BSW();// configuration_Range();break;case2:Run();break;}}//U1MODESET = 0x8000; // enable UART1return(EXIT_SUCCESS);}
Question
btb4198
I just keep getting 0 bytes and I do not know why.
I am using a ChipKit uC32 board and I have a Sparkfun RS232 Shifter connected to my computer.
I have RX from the Shifter wired to TX on the uC32 and TX wired to RX. and I see the light blinking for RX but it is not working.
When I use HyperTerminal, I connect to Com8( and I check and that is the right comport) .
I checked Device Manager, and the comport is set to 8 and Data bits is 8, Parity is None, Flow control is None, and Stop bits is 1.
and I set HyperTerminal so the same thing.
ok here is my code:
Can anyone help me ?
Link to comment
Share on other sites
14 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.