This has been bugging me enough to dig out a VDIP1 and take it along with me.
Here is what I got working. First off the "flash stick" was loaded with a file named VOLUME.TXT with 10:255 written in it so I think we are using the same file.
I do not have a VDIP Music module so this is working with a standard VDIP1. The attachment shows the firmware setting.
Below is my complete code. The long pauses are just there to make sure the VDIP is initialized before sending any commands to it.
The LCD displays 10 for VAR VOL and 255 for VAR VOL2.
I hope this helps.
Code:' 18F6680 VDIP ' 1384 BYTES DEFINE OSC 20 @ __CONFIG _CONFIG1H, _OSC_HS_1H @ __CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_128_2H @ __CONFIG _CONFIG4L, _LVP_OFF_4L DEFINE LCD_DREG PORTG define LCD_DBIT 0 DEFINE LCD_RSREG PORTE DEFINE LCD_RSBIT 0 DEFINE LCD_EREG PORTE DEFINE LCD_EBIT 1 DEFINE LCD_BITS 4 DEFINE LCD_LINES 4 DEFINE LCD_COMMANDUS 3000 DEFINE LCD_DATAUS 150 RXD VAR PORTE.2 'VDIP PIN 6 - DATA FROM VDIP TXD VAR PORTE.3 'VDIP PIN 8 - DATA TO VDIP FLOW VAR PORTE.4 'VDIP PIN 9 - VDIP RTS VOL VAR BYTE VOL2 VAR BYTE PAUSE 5000 PAUSE 5000 'SAFE START UP TIME FOR VDIP LCDOUT $FE,1,"MACKRCKIT" lcdout $FE,$D0," U.S.A." 'INTIALIZE VDIP STICK HIGH TXD PAUSE 5 SEROUT2 TXD,84,["ECS",13] HIGH TXD PAUSEUS 10 SEROUT2 TXD,84,["IPA",13] HIGH TXD PAUSEUS 10 WAIT11:IF FLOW = 1 THEN WAIT11 START:PAUSE 5000 serout2 TXD, 84, ["OPR VOLUME.TXT", 13] 'open file WAIT01:IF FLOW = 1 THEN WAIT01 serout2 TXD, 84, ["RD VOLUME.TXT", 13] 'read file SERIN2 RXD, 84, [DEC VOL,DEC VOL2] WAIT13:IF FLOW = 1 THEN WAIT13 serout2 TXD, 84, ["CLF VOLUME.TXT", 13] 'close file GOSUB DISPLAY GOTO START DISPLAY: LCDOUT $FE,1,"VOL ",DEC VOL lcdout $FE,$C0,"VOL2 ",DEC VOL2 lcdout $FE,$D0," U.S.A." PAUSE 250 RETURN





Bookmarks