User Activity

  • Posted a comment on discussion Open Discussion on GCBASIC

    Sorry, I realized immediately that it's not possible.. Just discard the last post.. Executing a DIM instruction will put to zero the flag anyway, and my problem is to check during the normal operations that if there is a power failure, the cpu must go in sleep, and preserve only WDT/RTC data and oscillators..

  • Posted a comment on discussion Open Discussion on GCBASIC

    What happens when the Watchdog has reset from Sleep the CPU? The execution starts from the beginning of program like the one of a Master Reset, or it returns to the Do-Loop? I may leave the sleep instruction just before the do-loop starts in such case .. If the pwr_down variable in RAM is preserved during the Sleep (provided the battery backup is still powering the CPU), then the if pwr_down=15 then sleep put before the do-loop could be the solution. I'll give it a try. But still do not understand...

  • Posted a comment on discussion Open Discussion on GCBASIC

    That's what I said I did in my previous post.. Down here is the flow of the program at present. The sleep instruction works only if put outside ISR and outside the main Do-Loop. Can't understand why. config & vars etc .. if I put SLEEP here, it works and gets executed .. Do forever ... other stuff to do forever... 'reset the Watchdog Timer ClrWDT 'if a flag of low voltage is set, put CPU to sleep if pow_down=15 then pow_down=0 sleep 'also here does not get executed end if loop sub Interrupt_Handler...

  • Posted a comment on discussion Open Discussion on GCBASIC

    Done some tests.. if I put the sleep instruction just after the config stuff and varaible declaration etc, it works. So I tought it was the use inside the ISR that was not possible. Then I changed the ISR removing the sleep instruction and made it to set a flag that the interrupt was served (i.e used a variable set to a known value like pwr_down =15); I would then check into the do-forever-loop if pwr_down=15 then sleep.. But also inside the loop the sleep instruction does not get executed. Very...

  • Posted a comment on discussion Open Discussion on GCBASIC

    Chip is the 18LF24J11. For all the other questions you made, except for the work outside the ISR, the answer is yes: On interrupt works, the HLVD event fires it, portB is cleared, but then if I measure the current absorbtion from a backup battery, I see some mAmps, as if the sleep mode is not initiated. I will try to simplify the overall program and see if sleep works outside the ISR. But just want to make sure the simple "SLEEP" syntax is correct or it's required some special character like # or...

  • Posted a comment on discussion Open Discussion on GCBASIC

    Hi, I am trying to experiment with low power modes, and using the Voltage failure interrupt I would like to put the mcu at sleep.. Down here the part of code used, basic and resulting assembler. The event of the HLVD module happens, the interrupt generated, but the SLEEP command does not get executed.. I can't find reference to such instruction on the Help, so I am not sure if the syntax is correct. I tried upper and lower case, no way , the CPU absorbs few mA instead of some tens of uA. Suggestions?...

  • Posted a comment on discussion Open Discussion on GCBASIC

    I think I finally figured out the way to unlock it.. My instructions sequence were correct, but there is a "misterious", or at least not well documented description of a Control Lock register, wich requires the following sequence of writes to the "virtual" (not a physical register) EECON2 register: EECON2=0x55; EECON2=0xAA; This is needed to enable Table read/writes of banks of memory fm Flash(16bits) to Ram (8bits). It also enable the writing of PPS register that contain the RTC portion.. So, if...

  • Posted a comment on discussion Open Discussion on GCBASIC

    Sorry to bother again on this, but I can't get the RTC working.. I think I did all the necessary settings to enable the module and it's clock correctly. I see on the scope that the T1 oscillator is resonating with the external xtal at the 32Khz, but when reading minutes and second values, I get out fixed values, non BCD coded, and it seems that the RTC is not counting at all.. Any suggestion? Rgds, GC 'sets the RTC clock to Timer1 oscillator as external crystal 32768Hz, to feed the internal RTC T1OSCEN=1...

View All

Personal Data

Username:
gc999
Joined:
2023-10-20 09:11:36.690000

Projects

  • No projects to display.

Personal Tools