I am really new to serial programming. I am having a MicroMag 3-Axis Magnetometer and I need to send a "go" command through the TX pin of the atmega 16 to the RX pin of the magnetometer so that it starts to send the data.I am programming in bascom and has correctly programmed to receive the magnetometer data but I can't send a command through the rs232 port.I am using the following serout command to send data by storing the ASCII value of "go" in a variable. But this does not work. Do I need to use some other command for this?
You need to be a member of diydrones to add comments!
There are a number of things you have to do:
1. Specify the baud rate
2. Specify the port you are going to use
3. Open the port and get printing to it
The default is to specify the baud rate using $baud= and then just Print the data you want. This uses the hardware UART which is the RX0/TX0 pins on the chip.
All this is very well documented in the Help files.
You can use the serout and that will print a variable that you have specified. Don't get hung up on the ASCII values of variables just Print the variable.
Your Go command will probably be a character or text string that you will send to the serial port which has to be recognised and then acted upon. Have a look at the Help file and the Inkey command together with Ischarwaiting which might give you a clue as to how to do this. Also have a look at the BASCOM forum at http://www.mcselec.com/.
Replies
1. Specify the baud rate
2. Specify the port you are going to use
3. Open the port and get printing to it
The default is to specify the baud rate using $baud= and then just Print the data you want. This uses the hardware UART which is the RX0/TX0 pins on the chip.
All this is very well documented in the Help files.
You can use the serout and that will print a variable that you have specified. Don't get hung up on the ASCII values of variables just Print the variable.
Your Go command will probably be a character or text string that you will send to the serial port which has to be recognised and then acted upon. Have a look at the Help file and the Inkey command together with Ischarwaiting which might give you a clue as to how to do this. Also have a look at the BASCOM forum at http://www.mcselec.com/.
Peter