If you want goto premakro to run when ticker>=150, perhaps you need to reframe that part with the else....endif
I wouldn't mind looking over the code if you want.
If you want goto premakro to run when ticker>=150, perhaps you need to reframe that part with the else....endif
I wouldn't mind looking over the code if you want.
"premakro" works fine, when I press a button, it gets called.
The issue as I see, that somehow, HPWM statement, when duty cycle is less than 100%, disrupts the code.
I'm using hardware PWM generators at PORTC.1 for brightness control PWM, and PORTC.2 for alarm buzzer sound
I modified DIMMER subroutine and set it to always make 255 duty cycle - then nothing fails. So how to relate these things together?
How often is dimmer called? Every hour, every minute, every time thru the main loop?
What if you make it always outout a dutycycle of 200, which is what it's getting set to 18.00 when the problem starts? Perhaps you have a hardware issue?
Also, as a test try to get rid of the "one-liners" and do:/Henrik.Code:IF Z2=06 THEN HPWM 2,150,2000 ENDIF IF Z2=08 THEN HPWM 2,200,2000 ENDIF
DIMMER gets called every second. I can fix this, but issue happens each minute, not second.
I tried inserting HPWM 1,200,2000 at random places in main loop - no issues. They only happen when that DIMMER sub is being called.
For the one-liners, they're great way to save yourself from a lot of scrolling, I'm writing code in that way for last 40 years, so I don't think that now is the time to change.
For the hardware issue, ADC reading is done at PORTA.0 and PWM output is at PORTC.1, so I don't think this can be a RMW issue.
The main loop can be divided into the following sections:
1. Get current time (read RTC)
2. If oldminute<>currentminute, then go seganime (animate all segments at each 1 minute change)
3. Convert hours into Z2
4. If autodim is enabled, then goto dimmer
5. alarm check and call subroutine
6. 12/24 hour check and conversion subroutine
7. Display current time routine
8. Keyboard handling code (ADC reading and debouncing)
9. middle dot blinking
GOTO?4. If autodim is enabled, then goto dimmer
OK but I thought we've showed by now that PBP is not "the same" as interpreted BASIC on you ZX Spectrum from '82.If you're sure that your one-liners work then fine but you wanted suggestion on how to debug the code and I was trying to give you ideas on what to try but never mind.For the one-liners, they're great way to save yourself from a lot of scrolling, I'm writing code in that way for last 40 years, so I don't think that now is the time to change.
Bookmarks