Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 10, 2016, 01:37:33 13:37


Login with username, password and session length


Pages: [1]
Print
Author Topic: [ouestion on rs232]  (Read 1040 times)
0 Members and 1 Guest are viewing this topic.
omidsht
Active Member
***
 Muted
Offline Offline

Posts: 193

Thank You
-Given: 60
-Receive: 16



« on: March 04, 2008, 03:30:10 15:30 »

Hi ,
I have designed a circuit with avr which communicates with PC , avrsends data to pc and gets data from pc with rs232 .
i want to send and receive numbers from zero two FF , not ascii , just hex code from 00 to FF (in decimal : 0 to 255) .
but , i have read that the computer and micro sends ascii code , and  ascii codes does not support the whole range of 00 to FF , so what shall i do ?


omid Huh
Logged
FriskyFerret
Hero Member
*****
Offline Offline

Posts: 564

Thank You
-Given: 513
-Receive: 358


Put it in, take it out.


WWW
« Reply #1 on: March 04, 2008, 05:31:13 17:31 »

Quote
i have read that the computer and micro sends ascii code

You do not yet understand the task fully enough. ASCII is a way of interpreting binary data.

Set up your AVR to transmit serial communications at your chosen baud rate and "N,8,1" communication parameters (No parity, 8 data bits, 1 stop bit.)

Remember that the transmit pin of one device must be connected to the receive pin of the other and vice versa. They are different pins on 9-pin connectors vs. 25-pin connectors. Watch out.

On the PC side you need to configure the serial port to match the baud speed and communication parameters of the AVR. You may also need to tell your compiler or application to treat the data as binary and to declare no "flow control."

RS-232 serial communication is simple in theory. In practice there are a number of snags and pitfalls like baud, parameters, wiring, hardware/software flow control, error control, etc.

You should study Jan Axelson's serial communications book. Its widely available on the ebookz community and here on sonsivri.
Logged

Dancing pants and leotards, that's what I'm talkin' about!
abbas1707
Junior Member
**
Offline Offline

Posts: 76

Thank You
-Given: 15
-Receive: 25



WWW
« Reply #2 on: March 04, 2008, 10:46:08 22:46 »

so what..........simple man
consider you have a number say 15 (0x0f) in your micocontroller
convert it to string of characters
i.e "15"
than send this string to pc
Logged

A Thousand Miles Journey Starts With a Single Step
songokoki
Junior Member
**
Offline Offline

Posts: 73

Thank You
-Given: 19
-Receive: 48



« Reply #3 on: March 10, 2008, 06:01:24 06:01 »

Dear omidsht,

This is a example for you, contain:

Code C to microcontroller, (CVARV  project)
Code VB2008
Proteus simulation

Use the Virtual Serial Port, create COM3 and COM4.

The VB project uses the COM4 virtual port, and the Proteus simulation uses the COM3 virtual port.

Regards,
Songokoki
(sorry for my limited english)
« Last Edit: March 10, 2008, 07:45:56 07:45 by songokoki » Logged
abdullahshawky
Newbie
*
Offline Offline

Posts: 20

Thank You
-Given: 8
-Receive: 19


« Reply #4 on: March 14, 2008, 11:29:26 23:29 »

hi,

all these responses doesnt give you the answer but the answer in bascom is very simple just use the (PRINTBIN) command its function si the following.

PRINTBIN

Print binary content of a variable to the serial port.

please add a thanks note if you find this useful
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC