Go Back   PICAXE Forum > Finished User PICAXE Projects > User Projects - Audio/Visual
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
Links: PICAXE Website PICAXE Manual Datasheets Online Store Software & Drivers

Reply
 
Thread Tools Display Modes
Old 29-12-2009, 02:27   #1
westaust55
Senior Member
 
Join Date: Mar 2008
Location: Western Australia
Posts: 4,973
Default

Thanks for the update Grogster.

I have updated post 1 with your data and that by picIt from another thread in the active forum area.
__________________
:
westaust55

Hey Hamlet, 2B OR NOT 2B = $FF
westaust55 is offline   Reply With Quote
Old 02-04-2010, 19:21   #2
russbow
Senior Member
 
Join Date: Feb 2009
Location: st albans
Posts: 356
Default

Thank you for all this information Gentlemen. It has motivated me to buy a Somo!

I have it working on a breadboard in key mode and the results are pleasing. Interestingly enough, the Transcend card does not work but a cheap glee-bay one does.

I now want to Picaxe it to produce fun phrases from the robot. I understand the code kindly given, but a couple of questions.

Having looked at the assigned pins in the prog, I assume an 08m chip. Am I right?

Considering this code snip

Code:
For track = 0 to 30			
		dta = $FFF5				
		GOSUB Send2SOMO			
							
							

	 	dta	= track			
	 	GOSUB Send2SOMO			
		GOSUB Holdtilldone					
	NEXT track
I want pre-determined phrases to sound as the result of an "event" - IR resonse, bump switch, sonar etc.

I shall delete the track for / next loop ( and probably the volume instruction ), set a variable EVENT to a decimal number and then substitute dta=EVENT for dta=track above.

I cant see any reason to change the Send2SOMO or holdtilldone routines.

Am I on the right track ?

Thanks,

Russ
russbow is offline   Reply With Quote
Old 04-04-2010, 02:55   #3
westaust55
Senior Member
 
Join Date: Mar 2008
Location: Western Australia
Posts: 4,973
Default

I was using an 18X at the time I wrote the program previously posted.
So happens that input 2 (pin2) is on the same side of the chip as outputs 0 to 3.

Should work on the 08M or any other "M" series chip.
Program space could be the sole determination if the "M" series chips are big enough.

Otherwise, yes, what you propose should work.
__________________
:
westaust55

Hey Hamlet, 2B OR NOT 2B = $FF
westaust55 is offline   Reply With Quote
Old 06-04-2010, 04:13   #4
Grogster
Senior Member
 
Join Date: Jan 1970
Location: Dunedin, NEW ZEALAND
Posts: 699
Default

... and I was using a 14M PICAXE in my experiments.

Code:
'SOMO sound module controller interface


'Version:	2A - [29/11/2009] Original code
'		3A - [28/12/2009] Pre-requisite changed to <SOMO>

'CHIP: 14M PICAXE, Firmware version 9D or higher - won't work on 9B firmware.
'                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~           

'----------------
'PIN ASSIGNMENTS:
'----------------

'INPUT0 used for serial command input
'INPUT1,2,3 not used
'INPUT4 used for busy signal from SOMO module

'OUTPUT0 not used
'OUTPUT1 used for SOMO control(clock line)
'OUTPUT2 used for SOMO control(data line)
'OUTPUT3 used for SOMO control(reset line)
'OUTPUT4 used for 'Syntax Error' LED(not always used)
'OUTPUT5 used for piezo sounder(short beep for command acknowledge)


symbol control=b0	'Used for control bits - don't use for anything else
symbol dta=w6	'Data to module is a word(16-bit) value
symbol x=b5		'X marks the spot...
symbol mask=bit0	'Mask word for the shiftout proceedure
symbol MSB=$8000	'Most Significant Bit position is bit 16
symbol sda=2	'Serial data output is on pin2
symbol scl=1	'Serial clock output is on pin1


init:
 high scl		'Set clock idle state high
 low sda		'Set data idle state low
 wait 3
 gosub piezo
 'dta=$015F
 'gosub shiftout
 high scl
 low sda


start:
 serin 0,N1200,("<SOMO>"),b1,b2,b3,b4'Pre-requisite bytes + command bytes
 gosub piezo	'Sound piezo buzzer
 b13 = b1 * 16 + b2
 b12 = b3 * 16 + b4
 gosub shiftout
 high scl		'Set clock-line idle-high
 low sda		'Set data-line idle-low
 goto start		'Loop to start if no valid command byte
 


'================================
'CLOCK DATA TO MODULE SUBROUTINE:
'================================

shiftout:
  gosub rst		'Reset module first
  low scl		'Pull clock-line low
  pause 2		'Start-bit time
  for x = 1 to 16	'Start of shiftout code
  mask = dta and MSB / MSB
  low sda
  if mask=0 then skipMSB
  high sda
  
 skipMSB:
  if x = 16 then skippulse
  pulsout scl,20	'100uS minimum pulse-width for clock or data lines
  dta = dta * 2
  
  skippulse:
   next x		'End of shiftout code
   high scl		'Pull clock-line high
   pause 2		'End-bit time
 return
  
rst:
  low 3		'Reset module
  pause 5		'Reset pulse-width as per manual ver 3.0
  high 3		'"Release" reset
  pause 300		'Reset to first bit wait time as per manual ver 3.0
  return
  

'=======================
'BEEP PIEZO SUB-ROUTINE:
'=======================

piezo:
 high 5		'Turn on piezo beeper
 pause 150		'Wait some time
 low 5		'Turn off piezo beeper
 return
This code just waits for control bytes to be sent to the PICAXE at 1200 baud, and the 14M takes care of all the bit-banging etc. This works VERY well for me, and is dead easy to control with another PICAXE and a serout command.

I've also attached my schematic for you to look at how I have things wired up.
This circuit incorporates several ideas from this thread, and also the muting on the audio-out to stop clicks at the end of playback - the latter provided by 4D systems.

I'm not sure if this suits your purposes, but should give you and others something to go on, and what has been proven to work(for me) with the exception of some uSD cards...
Attached Images
File Type: jpg SOMO controller 1a.jpg (200.2 KB, 27 views)
Grogster is offline   Reply With Quote
Old 06-04-2010, 11:50   #5
westaust55
Senior Member
 
Join Date: Mar 2008
Location: Western Australia
Posts: 4,973
Default

@ Grogster,

I know that the early 14M's could only serout variables on pin 0 and could only pulsout on outputs 0,1 and 2 but can you clarify what to your knowledge prevents the use of a 14M at Ver B.

Have recently been given a few Ver.B 14M's and aware of some of the limitations but though they might still be used.
__________________
:
westaust55

Hey Hamlet, 2B OR NOT 2B = $FF
westaust55 is offline   Reply With Quote
Old 07-04-2010, 01:35   #6
Grogster
Senior Member
 
Join Date: Jan 1970
Location: Dunedin, NEW ZEALAND
Posts: 699
Default

Quote:
Originally Posted by westaust55 View Post
@ Grogster,

I know that the early 14M's could only serout variables on pin 0 and could only pulsout on outputs 0,1 and 2 but can you clarify what to your knowledge prevents the use of a 14M at Ver B.

Have recently been given a few Ver.B 14M's and aware of some of the limitations but though they might still be used.
From what I remember, it was a case of serin not working on anything but the serial-in pin with the early firmware. I know there was a known problem using the 14M like this if version 9B firmware was on the chip. Once you move to the later firmware, the problems went away. I know it was of some importance at the time, which is why it is mentioned in the comments.

Technical or one of the other members here in the know, will no doubt be able to give you a better explanation then I on the precise reasons for this...

This was the serout issue I was having:
http://www.picaxeforum.co.uk/showthread.php?t=13119

Last edited by Grogster : 07-04-2010 at 01:42.
Grogster is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:09.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
(c) Revolution Education Ltd 2007