|
|
View previous topic :: View next topic |
Author |
Message |
Tektronix
Joined: 13 Feb 2010 Posts: 4
|
ethernet module |
Posted: Sat Feb 13, 2010 3:08 pm |
|
|
I am trying to send serial data to a Parallax Internet Netburner embedded Ethernet module. I am using the PCWH compiler version 4.104. The documentation from Parallax shows how to send serial data to the module using a basic stamp. I am trying to use a pic18f452 chip and the PCWH compiler.
Part of my code is:
Code: |
#include <18F452.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=10000000)
…..
#use rs232(baud=9600, xmit=PIN_B1, rcv=PIN_B0,STREAM=NET,ERRORS,TIMEOUT=20, BRGH1OK )
….
fprintf (NET,"!NB0W21:TEST");
|
I do not think that the pins are not switched around because the fprintf statement will work about 60% of the time. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Feb 13, 2010 3:31 pm |
|
|
Quote: |
#use rs232(baud=9600, xmit=PIN_B1, rcv=PIN_B0,STREAM=NET,ERRORS,TIMEOUT=20, BRGH1OK )
|
You're using a software UART. Are you using interrupt routines in your
program ? If so, when interrupts occur, they will disrupt the bit timing of
the software UART. You can prevent that by adding the DISABLE_INTS
parameter to your #use rs232() statement. From the manual:
Quote: |
#USE RS232
DISABLE_INTS -
Will cause interrupts to be disabled when the routines get or put a
character. This prevents character distortionfor software implemented
I/O and prevents interaction between I/O in interrupt handlers and the
main program when using the UART.
|
Quote: |
#use rs232(baud=9600, xmit=PIN_B1, rcv=PIN_B0,STREAM=NET,ERRORS,TIMEOUT=20, BRGH1OK )
|
Also, on a software UART, the parameters shown in bold don't do anything.
The compiler ignores them. |
|
|
Tektronix
Joined: 13 Feb 2010 Posts: 4
|
|
Posted: Sat Feb 13, 2010 4:20 pm |
|
|
That was very good information. I wished the manual was a little clearer on which options are for software UART and which are for the hardware UART. I am still having trouble with the Ethernet module. The data is still not showing up. It might be a problem with the Netburner Ethernet module. Thanks again. |
|
|
jaimechacoff
Joined: 14 Feb 2010 Posts: 24 Location: Santiago, Chile
|
|
Posted: Sun Feb 14, 2010 12:14 pm |
|
|
hey, I think your problem with the Netburner is because you are connecting it through a router and because that now you cant see the information.
I know this because I have used the Netburner, and I had the same problem and it was just because the Netburner doesnt work under a router.
good luck. |
|
|
Tektronix
Joined: 13 Feb 2010 Posts: 4
|
|
Posted: Sun Feb 14, 2010 5:42 pm |
|
|
It’s possible that the netburner does not work well with a router, but not sure. I had the netburner module hooked up using a basic stamp which worked very well. I used the examples from the Parallax web site. Does anyone know an example in which serial data is sent or received from a PIC chip to a basic stamp? The basic stamp commands can send and receive serial data with a delay (pace) option. I am not sure how much delay is actually between characters being sent. What is the best way to send a null character through the serial port?
I have modified the code for the PIC18F452 chips many times and then tested, but still no luck.
Code: | #include <18F452.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=10000000)
#define CLS 0
#use rs232(baud=9600, xmit=PIN_B1, rcv=PIN_B0,stream=net,errors,timeout=20,disable_ints )
void main
fprintf (net," !NB0W04:WORKS OK \0");
fprintf (net," !NB0W04:WORKING OK%s",CLS);
while(TRUE){
}
fprintf (net," !NB0W04:Test");
delay_ms(1000);
} |
|
|
|
jaimechacoff
Joined: 14 Feb 2010 Posts: 24 Location: Santiago, Chile
|
|
|
Tektronix
Joined: 13 Feb 2010 Posts: 4
|
|
Posted: Mon Feb 15, 2010 7:30 pm |
|
|
The netburner displays the web pages just fine with the router setup I have. I just trouble getting the PIC18F452 to update variables on the displayed web pages. The same netburner with a basic stamp does update the variables as expected with basic code. |
|
|
|
|
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
|