Menu

WAIT: Compiler Help/Challenge - Can you assist with the development of Great Cow BASIC?

Anobium
2021-10-06
2021-11-15
<< < 1 2 (Page 2 of 2)
  • Chris Roper

    Chris Roper - 2021-10-18

    Yes simple interrupts could and should replace Waits.

    That is the Primary thinking behind the Millis Function in Arduino and GCBASIC.
    Rather than sit in a loop wasting cycles you can look at elapsed time and if it is not up return control to the next operation.
    If the Time is up, then you Toggle the LED, or whatever function the wait is controlling and then return control to the next task..
    Simple Multitasking.

     
    • stan cartwright

      stan cartwright - 2021-10-18

      I posted about using millis for a wait solution but anobium says it all works in multiples of 2 not for running a pic at 41KHz. I think wait works for set frequencies.
      Using interrupts can be difficult to learn how... and how much code can be used before the next interrupt. You don't want a program to be mainly running an interrupt.
      I mostly use a mega328p so only one lot of interrupts to learn and the freqcalc program link in help is handy.
      At least gcb uses real interrupts but for a beginner like me they seem seem to be surrounded in mystery when in fact they are, depending on the ucontroller, not that hard to understand and use.
      I wouldn't want to set up a pps pic interrupts... got to understand data sheets :(
      It's why I use a uno/nano board with gcb, I can use the board labels like digital4 and not have to look up what port it is.
      I got a do-every interrupt working with 328p. I could have used the millis() function but it worked, just counters for each event.

       
  • Anobium

    Anobium - 2021-10-08

    I am looking for further help to resolve a bug in AVR string concatenation.

    If you are an expert on AVR ASM and you can spend a few hours to help resolve a bug then please ping me.

    The issue within the string support libraries and can be seen by this simple program.

    #CHIP mega328p, 16
    'USART settings
    #define USART_BAUD_RATE 9600
    #define USART_TX_BLOCKING
    #define USART_DELAY OFF
    
    Do Forever
        wait 1 s
        HSerPrint "0"+"123"
        HSerPrintCRLF
    Loop
    

    The terminal gets 013 not 0123

    The error is specific. Needs to be fixed. Got time and expertise to help?

     
  • stan cartwright

    stan cartwright - 2021-10-16

    I had trouble with glcdprint (10,10,str(var)+" ",ili9341white)
    or something similar to print a var and a following space.

     
    • Anobium

      Anobium - 2021-10-16

      Would have to see the code with the error. But, pass a string variable to ensure the size is correct. So, do not do str(var)+" " as this uses the sysstringvararialbe and uses more RAM, the size of the sysstringvararialbe may be 1 (not 2).

       
      • stan cartwright

        stan cartwright - 2021-10-16

        like
        mystr=str(var)
        glcdprint (10,10,mystr+" ",ili9341white)
        that's more ram for mystr?
        var could be 3 digit then 1 so need to follow with 2 spaces.

         
<< < 1 2 (Page 2 of 2)

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.