Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 26, 2024, 11:14:57 23:14


Login with username, password and session length


Pages: [1]
Print
Author Topic: pic with serial communication  (Read 7082 times)
0 Members and 1 Guest are viewing this topic.
xloving
Guest
« on: October 22, 2010, 01:35:48 13:35 »

i have an inertial measurement unit from sparkfun electronics..
to get the data from the module i have to sent ^g (ctrl+g) through serial..
but i dont know how to sent it from a pic..

it is directly possible from hyper terminal..
but how to send it from a c code through pic??
i am using pic16f877a with 57600 baud and hitech c compiler cor coding..

please help
Logged
oldvan
Senior Member
****
Offline Offline

Posts: 372

Thank You
-Given: 154
-Receive: 107


If the van is a Rockin'...


WWW
« Reply #1 on: October 22, 2010, 05:14:14 17:14 »

CTRL G is ASCII BEL, 0x07.

send an 0x07 out the serial port, possibly followed by a CR and/or a LF, should do the trick.

« Last Edit: October 22, 2010, 05:18:13 17:18 by oldvan » Logged

Give a man a fish and you feed him for a day.
Teach a man to fish and he will sit around in a boat drinking beer all day.
zuisti
Senior Member
****
Offline Offline

Posts: 409

Thank You
-Given: 242
-Receive: 780


« Reply #2 on: October 22, 2010, 06:27:25 18:27 »

Oldvan's tablet is perfect, I would add only two things:

1.
At my opinion do not send CR and/or LF.
2.
A simple calculation:
cntrl G = "G" - "A" + 1 =  71 - 65 + 1 = 7

Similarly:
cntrl A =  "A" - "A" + 1 =  65 - 65 + 1 = 1
cntrl B =  "B" - "A" + 1 =  66 - 65 + 1 = 2
...
cntrl Z =  "Z" - "A" + 1 =  90 - 65 + 1 = 26 (dec)

zuisti
Logged
odsk
Junior Member
**
Offline Offline

Posts: 53

Thank You
-Given: 13
-Receive: 12


« Reply #3 on: October 22, 2010, 07:52:34 19:52 »

Yes
As the previous post from Zuisti, just send char(7) which is equivalent to Ctrl+g

ODSK
Logged
ambo
Newbie
*
Offline Offline

Posts: 23

Thank You
-Given: 127
-Receive: 6


« Reply #4 on: November 30, 2010, 11:25:17 23:25 »

if you are using hitech c just use
printf("\x007") or putch(0x07)
Logged
nigelmercier
Newbie
*
Offline Offline

Posts: 9

Thank You
-Given: 2
-Receive: 0


« Reply #5 on: January 03, 2011, 11:44:29 23:44 »

A simple calculation...

No calculation required, just find the letter in the table, then look at the left column on the same row.

Don't you just love hex!

Logged
xloving
Guest
« Reply #6 on: February 15, 2011, 03:50:42 15:50 »

yes i do... :-) and it worked perfectly fine for me..
thank you so so much and sorry for the delay in giving thanks..

also i loved working with hterm.. it shows data in hex decimal ascii and binary..
so no confusion for the recived data..
it also has a time stamp..
so its helpfull in real time coding ..
thanks a lot..
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