Light Controller Problem
lboucher
Posts: 139
HI Everyone
So i am really new to SX and assembly.
I am trying to make an SX christmas light controller. (Actually several connected together)
So out of the 20 IO pins on the SX28 i plan to have 17 light channels, 1 rx serial line from a laptop, 1 tx serial line to the next microcontroller in the in the sequence, and 1 zero cross detector.
I have not implimented the serial tx yet.
So far i have implimented an interrupt based serial receive, and dimming control for 4 channels.
This works just fine.
When i try to take this same code and ramp up to 17 channels it doesn't work.
I am thinking i am doing something wrong with banking?
I really don't know how to debug this problem and need help.
I have attached my code for the working 4 channel controller and the non working 17 channel controller.
Please help.
So i am really new to SX and assembly.
I am trying to make an SX christmas light controller. (Actually several connected together)
So out of the 20 IO pins on the SX28 i plan to have 17 light channels, 1 rx serial line from a laptop, 1 tx serial line to the next microcontroller in the in the sequence, and 1 zero cross detector.
I have not implimented the serial tx yet.
So far i have implimented an interrupt based serial receive, and dimming control for 4 channels.
This works just fine.
When i try to take this same code and ramp up to 17 channels it doesn't work.
I am thinking i am doing something wrong with banking?
I really don't know how to debug this problem and need help.
I have attached my code for the working 4 channel controller and the non working 17 channel controller.
Please help.
Comments
Since SX/B arrays can only have 16 entries (if I remember), just try expanding up to a 16 channel dimmer. Yes, you'll have a spare pin unused, but I have a feeling it will make all your code work without a lot of effort.
Thanks,
PeterM
I did it for you in the attachement.
SXB does support large arrays on sx28,so you could use
level var byte (17) span
acc var byte (17) span
for index = 0 to 16
· acc(index) = acc(index) + level(index)
next
But this does generate slightly more code due to the spanned arrays.
regards peter
Why do i only need to set the right bank in the interrupt routine, do i not also have to worry about the main program?
Thanks
LUcas
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
If you use RS-485 or some other multi-drop scheme you may not need to implement TX.
[noparse][[/noparse]Edit] Inserted required BANK statements.
Post Edited (JonnyMac) : 3/12/2009 9:48:08 PM GMT
I am implimenting Renard Version 1 by the way.
Looking at this breifly at work i have questions.
first of which is, why is there no "bank" statements don't ya need them?
What does the Delay MS sub function do?
DELAY_MS is a replacement for PAUSE in case you want to do some stand-alone sequencing and need a way to do accurate delays. If you want to hold the program for one second you do this:
DELAY_MS 1000
If you use PAUSE the delay won't be accurate because the ISR will extend the timing. BTW, in my updated program I recoded DELAY_MS and RX_BYTE in Assembly.
Post Edited (JonnyMac) : 3/12/2009 10:18:22 PM GMT
Even have the TX implimented, i think it is working, but need to set up a second SX chip to be sure.