MrSafe
- 13th September 2007, 22:24
Hi
Hardware:
Pic 18f452
And I am trying to communicate and program a text to speed module.
Heres the link to the module.
http://www.picbasic.co.uk/forum/newthread.php?do=newthread&f=4
The link to the tech sheet for the device:
http://www.robot-electronics.co.uk/htm/Sp03doc.shtml
I am using the pl1 pint section to program the unit:
I use the SDA and SCL pins which connect to my pic.
I am unsure how to program this unit I have tried with no success and with the unability to get any response for it. The unit has a default message which plays when you turn it on. Which is "thank you for purchasing the sp03".
Heres my code that I am trying to use to talk with the unit:
'************************************************* ***************
'* Name : UNTITLED.BAS *
'* Author : *
'* Notice : Copyright (c) 2007 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 8/14/2007 *
'* Version : 1.0 *
'* Notes : *
'* : *
'************************************************* ***************
'
'---- Defining Modefier 4 serial in/out ----
'
include "modedefs.bas"
'
'---- Defining Oscillator ----
'
define OSC 4 ; Using 4MHz Oscillator
'
'---- Defineing Ports ----
'
TRISB = $00
PORTB = $00
TRISD = $00
PORTB = $00
'
'---- Defining TX Variables ----
'
X var word
Y var word
'
'---- Defining Variables ----
'
DEFINE I2C_HOLD 1
define I2C_SLOW 1
'
'---- Starting Of Main Program ----
'
Main:
pause 4000
'
Start:
serout PORTD.0, T9600, [#80]
pause 100
'
serout PORTD.0, T9600, [#00]
pause 100
'
serout PORTD.0, T9600, [#04]
pause 100
'
serout PORTD.0, T9600, [#02]
pause 100
'
for x = 0 to 6 ; output the following
lookup x, [$68,$65,$6C,$6C,$6F,$00],y
serout PORTD.0, T9600, [y]
pause 10
next x
'
goto start
'
end
I have also uploaded a copy of my code in a text file for anyone who needs to download it.
All the fallowing code does is get the unit to say hello however I am unable to get it to say hello. I think first my programing code is wrong and two my hardware set up is wrong. Where do I connect the SDA pin to? and the SCL? do I simply connect the scl to a random pin on the pic? and the SDA to my data transmitting pin on the pic?
Hardware:
Pic 18f452
And I am trying to communicate and program a text to speed module.
Heres the link to the module.
http://www.picbasic.co.uk/forum/newthread.php?do=newthread&f=4
The link to the tech sheet for the device:
http://www.robot-electronics.co.uk/htm/Sp03doc.shtml
I am using the pl1 pint section to program the unit:
I use the SDA and SCL pins which connect to my pic.
I am unsure how to program this unit I have tried with no success and with the unability to get any response for it. The unit has a default message which plays when you turn it on. Which is "thank you for purchasing the sp03".
Heres my code that I am trying to use to talk with the unit:
'************************************************* ***************
'* Name : UNTITLED.BAS *
'* Author : *
'* Notice : Copyright (c) 2007 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 8/14/2007 *
'* Version : 1.0 *
'* Notes : *
'* : *
'************************************************* ***************
'
'---- Defining Modefier 4 serial in/out ----
'
include "modedefs.bas"
'
'---- Defining Oscillator ----
'
define OSC 4 ; Using 4MHz Oscillator
'
'---- Defineing Ports ----
'
TRISB = $00
PORTB = $00
TRISD = $00
PORTB = $00
'
'---- Defining TX Variables ----
'
X var word
Y var word
'
'---- Defining Variables ----
'
DEFINE I2C_HOLD 1
define I2C_SLOW 1
'
'---- Starting Of Main Program ----
'
Main:
pause 4000
'
Start:
serout PORTD.0, T9600, [#80]
pause 100
'
serout PORTD.0, T9600, [#00]
pause 100
'
serout PORTD.0, T9600, [#04]
pause 100
'
serout PORTD.0, T9600, [#02]
pause 100
'
for x = 0 to 6 ; output the following
lookup x, [$68,$65,$6C,$6C,$6F,$00],y
serout PORTD.0, T9600, [y]
pause 10
next x
'
goto start
'
end
I have also uploaded a copy of my code in a text file for anyone who needs to download it.
All the fallowing code does is get the unit to say hello however I am unable to get it to say hello. I think first my programing code is wrong and two my hardware set up is wrong. Where do I connect the SDA pin to? and the SCL? do I simply connect the scl to a random pin on the pic? and the SDA to my data transmitting pin on the pic?