I have invested in them both myself (a shiny new PICAXE-28X1 and a VMusic2) and am really impressed with both. I'm working with both to give the old TI-83 Plus USB capabilities (and probably 83 too, though the front-end I'll write might need some work due to missing ROM calls).
The VMusic 2 is a smallish, low-cost, compact unit. It's self contained, has a simple jumper switch on the back (to choose SPI or serial UART mode), row of pins (so you can connect the +5V, 0V, and serial I/O lines) and a right/left line out header. On the front is a headphone jack and a standard sized USB port. A red/green LED reports the status.
What, exactly, does it do? Well, it is based around the Vinculum VNC1L-1A USB host controller. This controller basically provides a simple level of abstraction on top of USB communications. On top of this it also offers the ability to transparently handle FAT mass storage devices, and this VMusic2 version can also play MP3 files.
You can control it over a standard serial link, and it's pretty much like using DOS.
Code: Select all
D:\>
No Upgrade
D:\>
DIR
TIEMEK~1.MP3
VMUSIC2.JPG
WHO DIR
D:\>
CD WHO
D:\>
DIR
. DIR
.. DIR
BORIS.MP3
WHORYOU.MP3
D:\>
CD ..
D:\>
DLD WHO
Dir Not Empty
D:\>
The device supports (rough list):
- Directories - changing, creating, deleting, renaming.
- Files - reading (all or in chunks), deleting, writing, renaming, seeking.
- Disks - get free space, suspend (power).
- Music - play single, play all in current directory and its subdirectories, stop, skip next, skip previous.
This is all very well, but how can we use this on our beloved TI calcs?
The PICAXE-28X1 gives us what we need. Hardware-based serial I/O can receive data in the background, where we can pick it up from the chip's 128-byte scratchpad RAM. Programmable I/O lines on port C can be used to directly hook to up a TI calculator's link port (we need to read and write to the pins; pins are designated as input OR output, but by setting DIRSC you can set the direction.
Best of all, all you need are five connections - +5V, 0V, reset (tied high), serial in and serial out; no PIC programmer required.
Code: Select all
; ================================================================= ;
; Texas Instruments Link Protocol routines. ;
; ================================================================= ;
{
; ----------------------------------------------------------------- ;
; TiLPIn - Input a byte via the Texas Instruments link protocol. ;
; ----------------------------------------------------------------- ;
; Inputs: None. ;
; Outputs: B0 = Byte input. ;
; Destroys: B1, B2. ;
; ----------------------------------------------------------------- ;
TiLPIn:
; Shift in eight bits:
For B1 = 0 To 7
; Shift >>= 1
Let B0 = B0 / 2
; Wait for either pin to go low:
Let B2 = 10
Do
If Pin0 = 0 Then TiLPInBit0
If Pin1 = 0 Then TiLPInBit1
Dec B2
If B2 = 0 Then Return : EndIf
Loop
; Received a 0 bit:
TiLPInBit0:
Low PortC 1 ; Hold data 1 low.
If Pin0 = 0 Then TiLPInBit0 ; Wait for data 0 to go high.
Let DirsC = %00000000 ; Release data 1.
Goto GetNextBit
; Received a 1 bit:
TiLPInBit1:
Low PortC 0 ; Hold data 0 low.
Let Bit7 = 1 ; Add the bit to B0.
If Pin1 = 0 Then TiLPInBit1 ; Wait for data 1 to go high.
Let DirsC = %00000000 ; Release data 0.
GetNextBit:
Next B1
Return
; ----------------------------------------------------------------- ;
; TiLPOut - Output a byte via the Texas Instruments link protocol. ;
; ----------------------------------------------------------------- ;
; Inputs: B0 = Byte to output. ;
; Outputs: None. ;
; Destroys: B1. ;
; ----------------------------------------------------------------- ;
TiLPOut:
For B1 = 0 To 7
If Bit0 = 0 Then
Low PortC 0
Do While Pin1 = 1 : Loop
Let DirsC = %00000000
Do While Pin1 = 0 : Loop
Else
Low PortC 1
Do While Pin0 = 1 : Loop
Let DirsC = %00000000
Do While Pin0 = 0 : Loop
EndIf
Let B0 = B0 / 2
Next B1
Return
}
Code: Select all
; ================================================================= ;
; Entry Point / Main Loop. ;
; ================================================================= ;
{
Main:
; Use 8MHz clock speed.
SetFreq M8
; Set up background serial receive.
HSerSetup B9600_8, %01
; RTS
Low 0
Do
GoSub TiLPIn
If B1 = 8 Then
#IfDef Debug
SerTxd("In", 9, B0, 9, #B0, CR, LF)
#EndIf
HSerOut 0,(B0)
EndIf
High 0
Let B3 = 0
Do While B3 != HSerPtr
Get B3, B0
#IfDef Debug
SerTxd("Out", 9, B0, 9, #B0, CR, LF)
#EndIf
GoSub TiLPOut
Inc B3
Loop
HSerPtr = 0
Low 0
Loop
}
All in all, the above BASIC code (main loop and TiLP functions) comes to a mere 183 bytes. The PICAXE-28X1 has a whopping 4KB available, so we can pack a lot more functionality in if need be!
I've cobbled together a really rough program for the calculator.
Click to download (+PICAXE program).
WARNING: Likely to crash your calc. Use at own risk. Very rushed development on this.
Keys are as follows:
- Y= - Play All
- Window Stop
- Clear - Exit
- Up/Down - Move up and down columns
- Left/Right - Switch columns
- 2nd - Select
- Graph - Refresh list
If you don't feel like building this project, a video of what you're missing out on follows:
1.48MB AVI (MPEG-4, MP3)
No comments on my choice of music, thanks.
This program will only allow you to browse the first 32 directories/folders. This is by design (the directory listing buffer is savesScreen).
Some interesting problems to solve here; eg speed (it's very slow, currently, to browse directories as it downloads the entire directory listing first).
The only way I can see this working fast is an event-driven system. Creating a directory takes a long time, for example; might be better to send the command, then carry on letting the user browse the interface (but not send any more commands!) until the unit responds, at which point you could let them send commands again.