I have posted up my code and datasheets for reference but no one has any ideas ???? as yet ????
Please let me know if anyone can help me ??
Thanks
![]()
I have posted up my code and datasheets for reference but no one has any ideas ???? as yet ????
Please let me know if anyone can help me ??
Thanks
![]()
Can you be more specific? What do you mean it is not working, will it do nothing at all ? I notice you are trying to use PortA as digital, Have you disabled the comparators? Hint CMCON = ? Good idea to make it do a little dance before settling in to do serious work, like a heartbeat LED, just so you know life exists, helps keep from banging your head on the keyboard. That way you know the PIC is working but not as expected. you need to set ADCON register on this chip too.
Last edited by Archangel; - 23rd December 2008 at 05:59.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
I have disabled the Comparators; and All PortA pins are digital.
ANSEL = %00000000 ' PortA pins all digital
ADCON0 = %00000000
CMCON = 7 ' Turn off comparators(All digital)
When I say it is not working. It sends the data; but does not playback. I hear a few clicks and that is it.
What am I doing wrong here ???
I am guessing the data you are shifting out is somehow invalid. You are serial outputing data of nearly 2 full bytes, right? Is that what the module requires? I could not make that from that "data sheet". Please allow me to ask, does the module work if you switch it manually as in the schematic, by grounding p05? I feel like the data sheet is inadequate in it's detail as to how th control it with a microcontroller, it looks like p05 is the play button, P04 is clock(but for what) and P02 and p03 are to switch the wavs played, maybe it will spi control or not the way they show it. BTW do you have the SD card with appropriately named wavs programmed into it, installed? <font color=red>Where can get 1 of these to play with?</font color>
Last edited by Archangel; - 23rd December 2008 at 07:12.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
The updated code is as follows:
@ DEVICE XT_OSC,MCLR_OFF,LVP_OFF,WDT_OFF,PROTECT_OFF
DEFINE LOADER_USED 1
Include "Modedefs.Bas"
' ** Setup the Resonator Frequency, in Mhz **
Define OSC 4
'DEFINE SHIFT_PAUSEUS 100
ANSEL = %00000000 ' PortA pins all digital
ADCON0 = %00000000
CMCON = 7 ' Turn off comparators(All digital)
Baud con 84 ' 9600 baud rate
' ** Port configurations **
TX VAR PORTB.5
RX VAR PORTB.2
CLK VAR PORTA.4
DI VAR PORTA.0
RESET VAR PORTB.6
PIEZO VAR PORTB.7
DAT VAR word
Init:
TRISA=%11111111 ' Set PortA TRIS register
TRISB=%00000000 ' Set PortB TRIS register
begin:
low piezo
HIGH RESET
high CLK
high DI
LOW RESET
PAUSE 5
HIGH RESET
PAUSE 300
LOW RESET
dat = $FFF7
serout2 tx,baud,["1st Data = ",bin16 dat,13,10]
Shiftout DI, CLK,MSBFIRST,[dat/16]
dat = $3
serout2 tx,baud,["2nd Data = ",bin16 dat,13,10]
Shiftout DI, CLK,MSBFIRST,[dat/16]
dat = $fffe
serout2 tx,baud,["3rd Data = ",bin16 dat,13,10]
Shiftout DI, CLK,MSBFIRST,[dat/16]
end
**************************************************
It clicks and does not play; do you think I have the timing correct as per the diagram from the datasheet ?
Bookmarks