Got strange results with USART_DELAY OFF and #ifdef ... #endif. If the delay setting is inside the ifdef...endif, I get IFDEF/OFF: USART_DELAY equates to 1MS and cannot be reassigned to equate to OFF Moving it outside the #ifdef... #endif produces no error. There are other #defines inside the ifdef that produce no error. #chip 16F18044, 32 ' 32MHz #Option Explicit #define SerialOutput #startup InitPPS, 85 ' have to run PPS Before HSER runs #ifdef SerialOutput #define USART_DELAY OFF #define USART_BAUD_RATE...
I looked for that! Thank you!
I spent some hours tracking this down. As usual, it was my incomplete understanding of this setup and the error messages. I always carefully define my variables and aliases, never relying on the IDE to just make them up for me. I also like to declare bytes and aliases for the bits I use as conditions. Sure, the compiler would probably do it for me, but I like them explicitly being in one place. Upon a minor change to the code, it continued to compile fine, but gave me assembler errors saying that...
It has been a very happy new year - the mpk_build_1546 cured the problem with accessing the ZCD control register completely. Anobium, thank you so very much for turning around that fix, expecially during the "lost days" between Christmas and New Years. I'm impressed - and very thankful. The best of the new year to you and yours!!
Wooo-- Hoooooo!!! I had actually pondered banksel as an issue, but didn't even get close to that. Nice debugger, by the way.
An oddity popped up. While awaiting the microchip case comments (they are, reasonably, thinly staffed during the holidays) I decided to test whether I could read back the readable bits in ZCDCON - bits 7 and 4. So I did: #chip 16F18044 #option explicit #config ZCD=On DIR PORTC OUT Set ZCDCON.7 On Set ZCDCON.4 On Do ZCDCON.4 = NOT ZCDCON.4 LATC.3 = NOT LATC.3 LATC.7 = ZCDCON.7 LATC.1 = ZCDCON.1 LATC.0 = ZCDCON.0 wait 1 ms Loop ... and found that portc.3 toggles as expected, but both portc.7 and portc.4...
If you are going to open a support ticket, could you instead open it for this circuit? I think that this one would actually be applicable to more people's projects: 120Vac sine wave -- R1 (580K) -- ZCD pin (RA2) | | Rbias (1M) -- Vdd (5V) | C_Filter (47pF) -- gnd
I suppose I could transcode it into C for the Microchip X lab suite. I may just try to tinker the ASM listing, as assembler isn't all that difficult to write, just a pain. I'm still kind of stuck on why the ZCD in pin seems to be acting kind of like the description of what it does, but the ZCDOUT bit in the ZCDCON register would be either not changing state or else unreadable by machine code. An interrupt driven setup can be more difficult to debug, but simply polling a bit in a readable register,...