PDA

View Full Version : Connect PIc to Pocket PC



Keith
- 12th July 2005, 16:03
Anyone have any experience in connecting a Pic to a mobile device such as the Pocket PC. I would assume most of the problems would be wireing the cable correctly??


Thanks for any help....

rhino
- 12th July 2005, 16:28
Don't forget a level translator (max232). I've been looking at using bluetooth instead of a serial cable. Sparkfun.com has bluetooth modules you can interface with a pic. Seems like manufactures are going away from serial cables and they're getting harder and more expensive to find. I use a Dell X50v.

Keith
- 12th July 2005, 17:50
I checked out sparkfun... those bluetooth radio's are really slick! How would you connect one of them to a PIC to transmit to a base unit??

rhino
- 12th July 2005, 18:45
How would you connect one of them to a PIC to transmit to a base unit??
They have a pretty good tutorial in their tutorials section. The only thing that has prevented me from getting one is I've been looking for a hyperterminal type application for PPC that can use bluetooth. If anyone knows of one (preferrably free) please PM me.

Keith
- 12th July 2005, 20:20
They are transceiver's correct..???

rhino
- 12th July 2005, 20:35
Correct.... they have a UART onboard. So you set up your pic for serial comms, just as with a pc, except without the level tranlsator in this case since they are 5V tolerant. Then you send your serial data from the pic to the module, and it spits it out over the air to another bluetooth enabled device... and vise-versa. They have a really straight forward data sheet. I couldn't attach it.... too large. Here's the link

http://www.sparkfun.com/datasheets/RF/BlueSMiRF_v1.pdf

Like I mentioned earlier, I haven't used these yet, but they seem to be fairly easy to integrate with. If you get one... let us know how well it works!

Keith
- 12th July 2005, 23:46
thanks... I just downloaded the doc. I will probably give one a try... in the next few weeks .. I'll let you know how it works...

ccsparky
- 17th July 2005, 04:35
With some help from members on the PICBasic and NSBasicCE lists I was able to put together the code listed below. Using a PIC 16f88 and a MAX232 I am able to send and receive data between a 16f88 w/ Max232 and my PocketPC HP h2215. As I am a beginner at this, you'll see that this is very simple.
Hopefully this will help someone else!


The cable I used can be found here http://www.gomadic.com/comipseradca.html
The cost for the cable is $19.95 + s/h


'PicBasic Pro
'------------------------------------------------------
N VAR BYTE
Main:
SERIN SERRX,T9600,["@"],N 'Waits here until @ and either a, b or c is received from h2215
Pause 10
if n = "a" then SEROUT SERTX,T9600,["Here's your a"] ' if N = a send this back to h2215
if n = "b" then SEROUT SERTX,T9600,["Here's your b"] ' if N = b send this back to h2215
if n = "c" then SEROUT SERTX,T9600,["Here's your c"] ' if N = c send this back to h2215
Goto Main
End


'NSBasic-CE (Info on NSBasic http://www.nsbasic.com/ce/info/)
'------------------------------------------------------
Option Explicit
AddObject "comm","comm",0,0,0,0
Dim Instring

AddObject "commandButton","Writea",8,65,70,20
Writea.text="Write a"
AddObject "commandButton","Writeb",8,85,70,20
Writeb.text="Write b"
AddObject "commandButton","Writec",8,105,70,20
Writec.text="Write c"
AddObject "textBox","textbox1",8,145,224,20
TextBox1.borderstyle=1

Sub Open()
comm.Rthreshold = 1
comm.InputMode = 0
comm.handshaking=1
comm.RTSEnable=False
comm.DTREnable=False
comm.PortOpen = True
End Sub

Sub form_close()
Comm.PortOpen = 0
End Sub

Private Sub comm_OnComm()
Dim InString
InString = InString + comm.Input
textbox1.text = InString
End Sub

Sub Writea_Click
If comm.portopen = False Then Open
comm.Output = "@a"
End Sub

Sub Writeb_Click
If comm.portopen = False Then Open
comm.Output = "@b"
End Sub

Sub Writec_Click
If comm.portopen = False Then Open
comm.Output = "@c"
End Sub