|
|
View previous topic :: View next topic |
Author |
Message |
cvargcal
Joined: 17 Feb 2015 Posts: 134
|
pic18f26k22 Uart problem |
Posted: Tue Feb 17, 2015 4:29 pm |
|
|
I have this exactly problem:
http://www.microchip.com/forums/m542631.aspx
What happened?
Code: |
#include <18F26K22.h>
#Device PASS_STRINGS=IN_RAM
#fuses INTRC_IO, NOWDT, NOBROWNOUT, NOPUT, NOLVP, NOMCLR, PLLEN ,NOPBADEN // Fusibles
#use delay(crystal=16M,clock=16M)
#use rs232(baud=9600,bits=8,parity=N,xmit=PIN_C6,rcv=PIN_C7,stream=uart1) // Configuración UART1 (Hardware)
#use rs232(baud=9600,bits=8,parity=N,xmit=PIN_B6,rcv=PIN_B7,stream=uart2) // Configuración UART2 (Hardware)
#define FASTER_BUT_MORE_ROM //
#include <string.h> //
#include <stdlib.h>
#int_RDA // Interrupción por recepción de datos UART1
void RDA_isr1(void) { // Interrupción recepción serie USART
c=0x00; // Inicializo caracter recibido
if(kbhit(uart1)){ // Si hay algo pendiente de recibir ...
c=getc(uart1); // lo descargo y ...
agregar(c); // lo añado al buffer y ...
eco(c); // hago eco (si procede).
}
}
//------- Modulo WIFI------
#int_RDA2 // Interrupción por recepción de datos UART2
void RDA_isr2(void){ // Función a ejecutar
b=0x00; // Inicializo caracter recibido
if(kbhit(uart2)){ // Si hay algo pendiente de recibir ...
b=getc(uart2); // lo descargo y ...
buffer2[xbuff++]=b;
eco2(b); // hago eco (si procede).
}
}
/************************ FUNCIÓN PRINCIPAL *********************************/
void main()
{
setup_oscillator(OSC_16MHZ|OSC_INTRC|OSC_PLL_OFF);
setup_timer_0(T0_OFF);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
setup_timer_4(T4_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_ccp1(CCP_OFF);
setup_ccp2(CCP_OFF);
setup_ccp3(CCP_OFF);
setup_ccp4(CCP_OFF);
setup_ccp5(CCP_OFF);
setup_dac(DAC_OFF);
setup_adc(ADC_OFF | NO_ANALOGS);
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_wdt(WDT_OFF);
Wifi_init();
fprintf(uart1,"\r\n\** UART1 >> GPRS...OK **\r\n\r\n");
fprintf(uart2,"\r\n\** UART2 >> Wifi...OK **\r\n\r\n");
....
}
|
Someone can help me how configure it?
Because the code work only if put the RS232-USB.
but i when put the max232... the pin RX no work. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Feb 17, 2015 8:38 pm |
|
|
Post a link to a schematic of your connections between the PIC and the
Max232.
How to post an image on the CCS forum:
Go to this website:
http://postimage.org/
Upload your image. Select family safe. Then click the first button for
"Hotlink to Forum" to get a link to the image.
Then go to the CCS forum and type Ctrl-V to paste the link into a post.
If postimage.org doesn't work in your country, then use Google to find
another free image hosting site for forums. |
|
|
cvargcal
Joined: 17 Feb 2015 Posts: 134
|
|
Posted: Tue Feb 17, 2015 9:58 pm |
|
|
PCM programmer wrote: | Post a link to a schematic of your connections between the PIC and the
Max232.
How to post an image on the CCS forum:
Go to this website:
http://postimage.org/
Upload your image. Select family safe. Then click the first button for
"Hotlink to Forum" to get a link to the image.
Then go to the CCS forum and type Ctrl-V to paste the link into a post.
If postimage.org doesn't work in your country, then use Google to find
another free image hosting site for forums. |
Thank you for answer.
http://postimg.org/image/awrdn2kld/
Code: | #BYTE TRISB = 0xF93 // Configuramos el TRISB
#byte TRISC = 0xF94
#BYTE PORTB = 0xF81 // Configuramos el PORTB
#BYTE PORTC = 0xF82
#byte ANSELA = 0xF38
#byte ANSELB = 0xF39
#byte ANSELC = 0xF3A
#byte ANSELD = 0xF3B
#byte ANSELE = 0xF3C
void main()
{
TRISB = 0b10111111; //
TRISC = 0b10111111; //
ANSELB = 0x00; // All digital
ANSELC = 0x00; // All digital
}
|
the problem is not the max (i think), i am sure that the problem is the register... but i no know configure it.
The code work good with usb-ttl to each side... but when i connect the module wifi, the code work, but the pin RX no work :( ..
this guy find the solution
http://www.microchip.com/forums/m556612.aspx |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Feb 17, 2015 11:10 pm |
|
|
I just want to end this. I think it's some kind of Proteus bug and I don't
want to deal with it. So, I installed an 18F45K22 (same PIC family) in
my PicDem2-Plus board. I compiled the program shown below with
CCS compiler vs. 5.035. I loaded TeraTerm and typed random characters
into the terminal. It echoes them back. It's working:
This is with UART1 on pins C6 and C7, as your schematic shows.
If you think it's the CCS compiler, then post your compiler version.
It's given at the top of the .LST file, which is in your project directory
after a successful compilation. I'll test it with your version.
Code: | #include<18F45K22.h>
#fuses INTRC_IO, NOWDT, NOBROWNOUT, NOPUT, NOLVP, NOMCLR, PLLEN ,NOPBADEN // Fusibles
#use delay(crystal=16M,clock=16M)
#use rs232(baud=9600,bits=8,parity=N,xmit=PIN_C6,rcv=PIN_C7,stream=uart1) // Configuración UART1 (Hardware)
#use rs232(baud=9600,bits=8,parity=N,xmit=PIN_B6,rcv=PIN_B7,stream=uart2)
//=======================================
void main()
{
int8 c;
setup_oscillator(OSC_16MHZ|OSC_INTRC|OSC_PLL_OFF);
setup_timer_0(T0_OFF);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
setup_timer_4(T4_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_ccp1(CCP_OFF);
setup_ccp2(CCP_OFF);
setup_ccp3(CCP_OFF);
setup_ccp4(CCP_OFF);
setup_ccp5(CCP_OFF);
setup_dac(DAC_OFF);
setup_adc(ADC_OFF | NO_ANALOGS);
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_wdt(WDT_OFF);
while(TRUE)
{
c = fgetc(UART1);
fputc(c, UART1);
}
while(1);
} |
|
|
|
cvargcal
Joined: 17 Feb 2015 Posts: 134
|
|
Posted: Wed Feb 18, 2015 8:04 pm |
|
|
PCM programmer wrote: | I just want to end this. I think it's some kind of Proteus bug and I don't
want to deal with it. So, I installed an 18F45K22 (same PIC family) in
my PicDem2-Plus board. I compiled the program shown below with
CCS compiler vs. 5.035. I loaded TeraTerm and typed random characters
into the terminal. It echoes them back. It's working:
This is with UART1 on pins C6 and C7, as your schematic shows.
If you think it's the CCS compiler, then post your compiler version.
It's given at the top of the .LST file, which is in your project directory
after a successful compilation. I'll test it with your version.
Code: | #include<18F45K22.h>
#fuses INTRC_IO, NOWDT, NOBROWNOUT, NOPUT, NOLVP, NOMCLR, PLLEN ,NOPBADEN // Fusibles
#use delay(crystal=16M,clock=16M)
#use rs232(baud=9600,bits=8,parity=N,xmit=PIN_C6,rcv=PIN_C7,stream=uart1) // Configuración UART1 (Hardware)
#use rs232(baud=9600,bits=8,parity=N,xmit=PIN_B6,rcv=PIN_B7,stream=uart2)
//=======================================
void main()
{
int8 c;
setup_oscillator(OSC_16MHZ|OSC_INTRC|OSC_PLL_OFF);
setup_timer_0(T0_OFF);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
setup_timer_4(T4_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_ccp1(CCP_OFF);
setup_ccp2(CCP_OFF);
setup_ccp3(CCP_OFF);
setup_ccp4(CCP_OFF);
setup_ccp5(CCP_OFF);
setup_dac(DAC_OFF);
setup_adc(ADC_OFF | NO_ANALOGS);
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_wdt(WDT_OFF);
while(TRUE)
{
c = fgetc(UART1);
fputc(c, UART1);
}
while(1);
} |
|
because is diferent problem... see the full:
main.h
Code: |
#include <18F26K22.h>
#Device PASS_STRINGS=IN_RAM
#ZERO_RAM
#fuses INTRC_IO, NOWDT, NOBROWNOUT, NOPUT, NOLVP, NOMCLR, PLLEN ,NOPBADEN // Fusibles
/*
#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES INTRC_IO //Internal RC Osc, no CLKOUT
#FUSES NOPLLEN //4X HW PLL disabled, 4X PLL enabled in software
#FUSES NOFCMEN //Fail-safe clock monitor disabled
#FUSES NOIESO //Internal External Switch Over mode disabled
#FUSES NOBROWNOUT //No brownout reset
#FUSES WDT_SW //No Watch Dog Timer, enabled in Software
#FUSES NOPBADEN //PORTB pins are configured as digital I/O on RESET
#FUSES NOMCLR //Master Clear pin used for I/O
#FUSES NOSTVREN //Stack full/underflow will not cause reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
*/
#use delay(crystal=16M,clock=16M)
//#use delay(clock=16M)
// Crital 40MHZ
#use rs232(baud=9600,bits=8,parity=N,xmit=PIN_C6,rcv=PIN_C7,stream=uart1) // Configuración UART1 (Hardware)
#use rs232(baud=9600,bits=8,parity=N,xmit=PIN_B6,rcv=PIN_B7,stream=uart2) // Configuración UART2 (Hardware)
#define FASTER_BUT_MORE_ROM //
#include <string.h> //
#include <stdlib.h> //
//********** Configuración de puertos****************************
//#use standard_io(B)
//#byte PORTB =0xF81
//#byte PORTC = 0xF82
//#use FIXED_IO( B_outputs=PIN_B7,PIN_B6,PIN_B5,PIN_B4,PIN_B3,PIN_B2,PIN_B1,PIN_B0 )
//#use FIXED_IO( C_outputs=PIN_C7,PIN_C6,PIN_C5,PIN_C4,PIN_C3,PIN_C2,PIN_C1,PIN_C0 )
#BYTE TRISB = 0xF93 // Configuramos el TRISB
#byte TRISC = 0xF94
#BYTE PORTB = 0xF81 // Configuramos el PORTB
#BYTE PORTC = 0xF82
#byte ANSELA = 0xF38
#byte ANSELB = 0xF39
#byte ANSELC = 0xF3A
#byte ANSELD = 0xF3B
#byte ANSELE = 0xF3C
#byte ADCON1= 0xFC1
/****************************** Comandos Wifi ********************************/
//CONST CHAR* OK[] = "ok";
CONST CHAR* RESET1[] = "reboot\r\n";
CONST CHAR* CMD[] = "$$$";
CONST CHAR* CERRAR[] = "close\r\n";
CONST CHAR* SET_UART_BAUD[]= "set u b 9600\r\n";
CONST CHAR* SET_UART_TX[]= "set u tx 1\r\n";
CONST CHAR* SETUART[]= "set u m 0\r\n";
CONST CHAR* SETWLAN[]= "set w j 7\r\n";
CONST CHAR* SETCHAN[]= "set w c 7\r\n";
CONST CHAR* SETRATE[]= "set w r 3\r\n";
CONST CHAR* SETSSID[]= "set w s USER1\r\n";
CONST CHAR* SETPOWE[]= "set w t 12\r\n";
CONST CHAR* SETDHCP[]= "set i d 4\r\n";
CONST CHAR* SETIP[] = "set i a 192.168.10.1\r\n";
CONST CHAR* SETIPM[] = "set i n 255.255.255.0\r\n";
CONST CHAR* SETIPG[] = "set i g 192.168.10.1\r\n";
CONST CHAR* SETLEA[] = "set d l 86400\r\n";
CONST CHAR* SAVE[] = "save\r\n";
/****************************** Comandos GPRS ********************************/
CONST CHAR* SNDMG[]="AT$TTSNDMG=2"; // Mensaje de pedir IP
CONST CHAR* ID_IMEI[]="AT$TTDEVID?"; // ' ID IMEI
/****************************** Variables ***********************************/
//int new_line=0; // Bandera para indicarlinea completa recivida
//int i,n; // Contador
//char buffer[64]; // Buffer UART
//char SMS_CONTENT[64]; // Buffer SMS
//int flag1=0; // Variable para la interrupcion externa
//char buffer2[64]; // Buffer UART
// char valor1,valor2; // Variables
//char TXTRX[50];
//char DATARX[50];
//char DTMFCODE;
//char IMEI[15];
//char RXDAT[4];
//char RXDTMF[4];
//int BAND,j,RXOK,k,TM,ENTRO,TT,IMEIOK,KEY,TMP,FUP,SAVEKEY;
/***************************************************************/
// FUNCIONES
/***************************************************************/
int find_string(char*,char*); // Buscar cadena dentro de otra cadena
void clear_buffer(); // Limpiar buffer, reinicio de contadores y banderas
int get_sms_index(char*); // Encontrar index donde fue guardado el nuevo mensaje
int read_sms(int); // Lectura SMS y dectectar comandos en el SMS
void delete_sms(int); // Borrar SMS
void send_sms(char*,char*); // Emviar SMS
void decode_command(); // decode and do command (if found)
//void Iniciar();
void Wifi_init(void);
|
main.c
Code: |
#include <main.h> // Archivo de cabecera, configuración general.
int const lenbuff=64; // Longitud de buffer
int xbuff=0x00; // Índice: siguiente char en buffer1
int xbuff2=0x00;
char buffer1[lenbuff]; // Buffer1 UART1
char buffer2[lenbuff]; // Buffer1 UART2
char c=0x00; // Último caracter recibido UART1
char b=0x00; // Último caracter recibido UART2
int1 flagcommand=0; // Flag para indicar comando disponible
void clear_buffer1(void); // Borra buffer recepcion UART1
void clear_buffer2(void); // Borra buffer recepción UART2
void agregar(char c); // Añade caracter recibido al buffer1
void eco(char c); // Eco selectivo sobre RS232
void eco2(char b);
void procesa_comando(void); // Procesa comando
/************* FUNCIÓNES INTERRUPCIÓN POR RECEPCIÓN DE DATOS *****************/
//------- Modulo GPRG------
#int_RDA // Interrupción por recepción de datos UART1
void RDA_isr1(void) { // Interrupción recepción serie USART
c=0x00; // Inicializo caracter recibido
if(kbhit(uart1)){ // Si hay algo pendiente de recibir ...
c=getc(uart1); // lo descargo y ...
agregar(c); // lo añado al buffer y ...
eco(c); // hago eco (si procede).
}
}
//------- Modulo WIFI------
#int_RDA2 // Interrupción por recepción de datos UART2
void RDA_isr2(void){ // Función a ejecutar
b=0x00; // Inicializo caracter recibido
if(kbhit(uart2)){ // Si hay algo pendiente de recibir ...
b=getc(uart2); // lo descargo y ...
buffer2[xbuff++]=b;
eco2(b); // hago eco (si procede).
if(xbuff==lenbuff) xbuff=0x00; //Si buffer esta lleno se resetea
}
}
/************************ FUNCIÓN PRINCIPAL *********************************/
void main()
{
port_B_pullups(0xFF);
TRISB = 0b10111111; // RB4 and RB1 inputs (i2c)
TRISC = 0b10111111; // RB4 and RB1 inputs (i2c)
ANSELB = 0x00; // All digital
ANSELC = 0x00; // All digital
setup_oscillator(OSC_16MHZ|OSC_INTRC|OSC_PLL_OFF);
setup_timer_0(T0_OFF);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
setup_timer_4(T4_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_ccp1(CCP_OFF);
setup_ccp2(CCP_OFF);
setup_ccp3(CCP_OFF);
setup_ccp4(CCP_OFF);
setup_ccp5(CCP_OFF);
setup_dac(DAC_OFF);
setup_adc(ADC_OFF | NO_ANALOGS);
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_wdt(WDT_OFF);
disable_interrupts(int_rda); // Habilita Interrupción RDA UART1
disable_interrupts(int_rda2); // Habilita Interrupción RDA UART2
enable_interrupts(global); // Habilita interrupciones
//
delay_ms(2000);
Wifi_init();
//fprintf(uart1,"\r\n\** UART1 >> GPRS...OK **\r\n\r\n");
// fprintf(uart2,"\r\n\** UART2 >> Wifi...OK **\r\n\r\n");
fprintf(uart1,"[Enter] Procesa comando\r\n");
fprintf(uart1,"[Escape] Borra todo el buffer\r\n");
fprintf(uart1,"[Delete] Borra último carácter del buffer\r\n");
fprintf(uart1,"[\\w] Comando Escribe\r\n");
fprintf(uart1,"[\\r] Comando Lee\r\n\r\n");
clear_buffer1();clear_buffer2(); // Borra buffer al inicio
enable_interrupts(int_rda); // Habilita Interrupción RDA UART1
enable_interrupts(int_rda2); // Habilita Interrupción RDA UART2
// #priority int_rda2
do {
output_low(PIN_B0);
delay_ms(500);
output_high(PIN_B0);
delay_ms(500);
if(flagcommand) procesa_comando(); // Si hay comando pendiente de procesar ... lo procesa.
if(find_string(buffer1,"hola")){
fprintf(uart2,"\nLlego Hola\r\n");}
if(find_string(buffer1,"perro")){
fprintf(uart2,"\nLlego... Perro\r\n");}
if(find_string(buffer2,"casa")){
fprintf(uart1,"\nLlego... casa\r\n");clear_buffer2();}
} while (TRUE);
}
//******* Eco de caracter ***************
void eco(char c){ // Echo selectivo
switch(c){ //
case 0x0D: fprintf(uart1," [Ent] "); // Si he pulsado la tecla [Intro]
break; //
case 0x08: fprintf(uart1," [Del] "); // Si he pulsado la tecla [Retroceso]
break; //
case 0x20: fprintf(uart1," [Esc] "); // Si he pulsado la tecla [Escape]
break; //
default: putc(c,uart1); // Echo de cualquier otro caracter
}
}
void eco2(b){ // Echo selectivo
switch(b){ //
case 0x0D: fprintf(uart2," [Ent] "); // Si he pulsado la tecla [Intro]
break; //
//case 0x08: fprintf(uart1," [Del] "); // Si he pulsado la tecla [Retroceso]
// break; //
//case 0x20: fprintf(uart1," [Esc] "); // Si he pulsado la tecla [Escape]
// break; //
default: putc(b,uart2); // Echo de cualquier otro caracter
}
}
//******* Agregar a buffer1 *************
void agregar(char c){ // Añade a buffer1
switch(c){ //
case 0x0D: // Enter -> Habilita Flag para procesar
flagcommand=1; // Comando en Main
break; //
case 0x08: // Del -> Borra último caracter del Buffer
if(xbuff>0) buffer1[--xbuff]=0x00; //
break; //
case 0x20: // Space -> Borra el Buffer completamente
clear_buffer1(); //
break; //
default: //
buffer1[xbuff++]=c; // Añade caracter recibido al Buffer
}
}
//******* Procesador de Comandos ********
void procesa_comando(void){
int i;
char arg[lenbuff]; // Argumento de comando (si lo tiene)
flagcommand=0; // Desactivo flag de comando pendiente.
fprintf(uart1,"\r\nProcesando ... "); // Monitorizo procesando ...
for(i=0;i<lenbuff;i++){ // Bucle que pone a 0 todos los
arg[i]=0x00; // caracteres en el argumento
}
if(buffer1[0]=='\\'&&buffer1[1]=='r') // Comparo inicio del buffer con comando "\r"
{
fprintf(uart1,"Leyendo ... "); // Aqui lo que deseemos hacer con comando "\r"
}
if(buffer1[0]=='\\'&&buffer1[1]=='w'){ // Comparo inicio del buffer con comando "\w"
i=2;
do{ // Extraemos argumento del buffer
arg[i-2]=buffer1[i]; // a partir del 3er byte y hasta \0.
}while(buffer1[++i]!=0x00);
fprintf(uart1,"Escribiendo %s ... ",arg);// Aqui lo que deseemos hacer con comando "\w" Monitorizamos el argunmento.
}
clear_buffer1(); // Borro buffer.
fprintf(uart1,"Procesado.\r\n\r\n"); // Monitorizo procesado.
}
//******* Borrar Buffer1 ****************
void clear_buffer1(void){ // Inicia a \0 buffer1
int i; //
for(i=0;i<lenbuff;i++) // Bucle que pone a 0 todos los caracteres en el buffer
{ //
buffer1[i]=0x00; //
} //
xbuff=0x00; // Inicializo el indice de siguiente caracter
}
//******* Borrar Buffer2 ****************
void clear_buffer2(void){ // Inicia a \0 buffer1
int i; //
for(i=0;i<lenbuff;i++) // Bucle que pone a 0 todos los caracteres en el buffer
{ //
buffer2[i]=0x00; //
} //
xbuff=0x00; // Inicializo el indice de siguiente caracter
}
//******* Buscar Cadena *****************
int find_string(char* buf,char* word)
{
char*srch_word;
srch_word=strstr(buf,word);
if(srch_word>0)return(1);
else return(0);
}
//******* Modulo Wifi *******************
void Wifi_init(void)
{
// fprintf(uart2,RESET1);delay_ms(1000); // Reboot
fprintf(uart2,CMD);delay_ms(500); // $$$
fprintf(uart2,CERRAR);delay_ms(100); // Close
// fprintf(uart2,SET_UART_BAUD);delay_ms(500); // Set uart
fprintf(uart2,SETUART);delay_ms(100); // Set uart 0
fprintf(uart2,SETWLAN);delay_ms(100); // Set
fprintf(uart2,SETCHAN);delay_ms(100); //
fprintf(uart2,SETRATE);delay_ms(100); //
fprintf(uart2,SETSSID);delay_ms(100); // set w USER1
fprintf(uart2,SETPOWE);delay_ms(100); //
fprintf(uart2,SETDHCP);delay_ms(100); //
fprintf(uart2,SETIP);delay_ms(100); // set ip 192.168.10.1
fprintf(uart2,SETIPM);delay_ms(100); //
fprintf(uart2,SETIPG);delay_ms(100); //
fprintf(uart2,SETLEA);delay_ms(100); //
fprintf(uart2,SET_UART_TX);delay_ms(100);
fprintf(uart2,SAVE);delay_ms(100); //
fprintf(uart2,RESET1);delay_ms(2000); //
}
|
the code works fine, but when I connect the module wifi... block the pin the Uart2 RX or RX of the uart that I use. just as there
http://www.microchip.com/forums/m542631.aspx Why?
If I only connect the Tx pin and then i wait and connect Rx, it works well.
But if start all at the time, block the RX pin.
Why if i Use this, yes work without problem?: TTL/USB (Uart1) ---- PIC---- TT/USB (Uart2)
Last edited by cvargcal on Wed Feb 18, 2015 10:46 pm; edited 1 time in total |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Wed Feb 18, 2015 8:55 pm |
|
|
Please post the make/model of the 'wifi' module you're using.
i suspect it's the all too common 5 volt PIC - 3 volt peripheral problem.
Jay |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Feb 18, 2015 9:02 pm |
|
|
If Rx is blocked, the first thing to do is add the ERRORS parameter. Example:
Quote: |
#use rs232(baud=9600,bits=8,parity=N,xmit=PIN_C6,rcv=PIN_C7, ERRORS, stream=uart1)
#use rs232(baud=9600,bits=8,parity=N,xmit=PIN_B6,rcv=PIN_B7, ERRORS, stream=uart2)
|
|
|
|
cvargcal
Joined: 17 Feb 2015 Posts: 134
|
|
Posted: Wed Feb 18, 2015 9:21 pm |
|
|
Now i know... the error too see in the simulation... just when RX receive date (the wifi module send one message when ON)
the module is https://www.sparkfun.com/products/10822
yes of course i used 3.3 V for pic and module. |
|
|
cvargcal
Joined: 17 Feb 2015 Posts: 134
|
|
Posted: Wed Feb 18, 2015 10:44 pm |
|
|
PCM programmer wrote: | If Rx is blocked, the first thing to do is add the ERRORS parameter. Example:
Quote: |
#use rs232(baud=9600,bits=8,parity=N,xmit=PIN_C6,rcv=PIN_C7, ERRORS, stream=uart1)
#use rs232(baud=9600,bits=8,parity=N,xmit=PIN_B6,rcv=PIN_B7, ERRORS, stream=uart2)
|
|
Thank you! Yes!! now work add "ERRORS" |
|
|
|
|
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
|