I've mentioned a few times that I wrote a simple BASIC compiler as part of WinPicProg, and while I was looking for some assembly code for another thread (16F1827 - clearing GPR's), I came across a practical example.
Fairly 'famously' at Matlock Bath (near where I work) they do yearly Illuminations, including rowing boats on the river - these are decorated extensively, pirate ships, space ships. all kinds of things, and a large part of it is the lighting, flashing, sequencing etc. Generally it was done using those old motor driver cams with micro-switches.
Anyway, a guy at work used to enter, and he asked if I could build him something 'better' to control his lights - so I built a simple PIC16F628 feeding 8 driver transistors with open collectors, which switched bulbs fed from the 12V car battery used for power.
Then as at the time I was playing with my BASIC compiler, I wrote the code using that, rather than bothering with assembler.
This code is actually the second version, from 2005, the first was from 2003, the only difference was in the number of steps and sequencing to match his requirements for that years model.
As is obvious, it took VERY little time to write, and it's VERY simple to modify to meet his requirements each year.
Fairly 'famously' at Matlock Bath (near where I work) they do yearly Illuminations, including rowing boats on the river - these are decorated extensively, pirate ships, space ships. all kinds of things, and a large part of it is the lighting, flashing, sequencing etc. Generally it was done using those old motor driver cams with micro-switches.
Anyway, a guy at work used to enter, and he asked if I could build him something 'better' to control his lights - so I built a simple PIC16F628 feeding 8 driver transistors with open collectors, which switched bulbs fed from the 12V car battery used for power.
Then as at the time I was playing with my BASIC compiler, I wrote the code using that, rather than bothering with assembler.
This code is actually the second version, from 2005, the first was from 2003, the only difference was in the number of steps and sequencing to match his requirements for that years model.
As is obvious, it took VERY little time to write, and it's VERY simple to modify to meet his requirements each year.
Device 16F628
Freq=4
Data 4, 200, 2, 200, 1, 200, 2, 200, 4, 200, 2, 200, 1, 200, 2, 200, 4, 200, 2, 200 ,1 Data 200, 2, 200 ,4, 200
Data 2, 200, 1, 200, 2, 200, 4, 200, 5, 200, 2, 200, 5, 200, 2, 200, 5, 200, 2, 200 ,5 Data 200, 2, 200 ,5, 200
Dim A, CL, B
Define PortB=%00000000
Loop:
For CL=1 To 52
Read A
Read B
B=B*10
OutB(A)
DelayMS(B)
Next CL
Restore 0
Goto Loop
Stop
End