The Netduino forums have been replaced by new forums at community.wildernesslabs.co.
This site has been preserved for archival purposes only
and the ability to make new accounts or posts has been turned off.
I want to start one of my first project and i just copy this code in my VS2010 :
public class Program { static SerialPort serial; public static void Main() { // initialize the serial port for COM1 (using D0 & D1) serial = new SerialPort(SerialPorts.COM1, 115200, Parity.None, 8, StopBits.One); // open the serial-port, so we can send & receive data serial.Open(); // add an event-handler for handling incoming data serial.DataReceived += new SerialDataReceivedEventHandler(serial_DataReceived); // wait forever... Thread.Sleep(Timeout.Infinite); } static void serial_DataReceived(object sender, SerialDataReceivedEventArgs e) { // create a single byte array byte[] bytes = new byte[32]; // as long as there is data waiting to be read while (serial.BytesToRead > 0) { // read a single byte serial.Read(bytes, 0, bytes.Length); // send the same byte back serial.Write(bytes, 0, bytes.Length); } } }
m new to netduino world, m using a netduino plus 1 board,
the problem is m also using the above code for serial communication b/w n+ and the pc with an rs232 , and to obtain the output the hyperterminal software., nw the problem is the transmitting part is getting executed but receiving part is not working.
Hello Chris;
m using an usb cable b/w pc and n+ , and a 9 pin d-type connector for max232 and pc.
and yes the Datareceived event is getting fired., bt unable to retrieve the data.
Are you feeding RS232-voltage signals to the Netduino directly? Or is there some sort of shield involved? Photos would help us understand your setup better.
Please note that a USB-RS232 adapter may understand Netduino's 0-3.3V SerialPort output and display it in a terminal program on your computer...but the -5V to 5V (or up to -15V to 15V) signals of RS-232 will not work with your Netduino--and subjecting it to high voltages like that (without proper signal voltage conversion) may damage your Netduino.
Chris
And please - could You spend a little bit more time on writing Your posts? It's hard to read.
Just like Chris I think You should use some MAX232 for PC communication (or USB to TTL). Also try Debug.Print(buffer.ToString());
For RS485 use MAX485 or 75176 and then connect one pin from Arduino to pin 2 and 3 in MAX. If it's LOW then it's receiving and when it goes HIGH You are able to transmit.
Example - Pin 3 connected to MAX485 pin 2 and 3
[color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]static OutputPort pin = new OutputPort[/color](Pins.GPIO_PIN_D3, false);
so pin is all the time low so event for reading can be fired.
and then later in code You should have something like this
I gone through the [color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]thread u suggested and i tried out the coding, its displaying only "[/color]transmit thread works" after every 5 sec
[color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]I have a doubt that for receiving the output, are u using any " hyperterminal software" or any such software???[/color]
This code was made by me from other examples just for testing purposes (this is why it is printing "transmit thread works" - i just wanted to know that the thread is running).
For communicating with PC I have used Arduino Mega and Arduino IDE serial monitor - the only job for arduino was read from one UART and write it to second (read from Netduino and write to PC) and same thing in other direction (read from PC and write to netduino).
it is from polish electronic forum and guys was trying to use 75176 without noise (You can see there some pull up resistors etc.) - I will try this... maybe next week
hello lifanek,
i'm really sorry first of all., i will definetly keep in mind what u said.
and yes i'm already using a [color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]MAX232 for PC communication (or USB to TTL)., [/color]
[color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]i have an ADM3485 IC for RS485, will it work.????[/color]
Check out data sheets for this device - for example MAX485 and 75176 for me look like same device just made by other companies - maybe ADM3485 is just like that.
this is the shot of my set-up, but still i'm unable to communicate with pc. The netduino on-board led links when ever i press a botton from the keyboard.
Hi sayantan,
Your best bet here is that there's some sort of voltage level conversion issue--or a loose wire, etc.
What voltage is your TTL-RS232 logic level converter expecting? If it's 3.3V, then that's fine. If it's 5V then it may not be picking up on the Netduino's output data signals properly.
Also...have you double-checked your Ground connection from Netduino to PC (i.e. they must both be sharing a common ground)?
Chris
This post seems to be about a month old so maybe you've already figured out the solution, but...
It seems to me that what is likely happening is HyperTerminal is not configured to display the keys you're typing - aka "local echo". If this is true, then what is happening is:
1. you type a character (it is NOT displayed in HyperTerminal)
2. your Netduino receives the character
3. your Netduino blinks the LED
4. your Netduino sends the character back to HyperTerminal
5. HyperTerminal displays what it received
The question is - what are you expecting to see? If you press "A", are you expecting to see "AA"?
Try looking for a setting in HyperTerminal that allows you to turn ON local echo.
I ran into this same exact issue with Putty this weekend.