Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 11, 2016, 02:42:31 14:42


Login with username, password and session length


Pages: [1]
Print
Author Topic: pic with serial communication  (Read 3763 times)
0 Members and 1 Guest are viewing this topic.
xloving
Guest
« on: October 22, 2010, 02:35:48 14: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
V.I.P
Senior Member
*****
Offline Offline

Posts: 375

Thank You
-Given: 152
-Receive: 106


If the van is a Rockin'...


WWW
« Reply #1 on: October 22, 2010, 06:14:14 18: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, 06:18:13 18: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: 371

Thank You
-Given: 219
-Receive: 567


« Reply #2 on: October 22, 2010, 07:27:25 19: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: 11
-Receive: 12


« Reply #3 on: October 22, 2010, 08:52:34 20:52 »

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

ODSK
Logged
ambo
Newbie
*
 Muted
Offline Offline

Posts: 23

Thank You
-Given: 112
-Receive: 6


« Reply #4 on: December 01, 2010, 12:25:17 00: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 04, 2011, 12:44:29 00: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, 04:50:42 16: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