The Godfather talking
You may crack software. How about me?
Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
March 28, 2024, 10:28:20 22:28


Login with username, password and session length


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

Posts: 192

Thank You
-Given: 60
-Receive: 16



« on: March 04, 2008, 02:30:10 14: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: 560

Thank You
-Given: 513
-Receive: 360


Put it in, take it out.


WWW
« Reply #1 on: March 04, 2008, 04:31:13 16: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, 09:46:08 21: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