• PicŪ Basic

  • HRSOut by interrupt

    This code has been requested by "Maxi" (PDS user in the forum) for saving time in the execution of the main program. See the thread HERE.

    The idea is #disable the HRSout command and rewrite the low level routine to send bytes to a circular buffer (very fast). In the interrupt routine the bytes of the array will be sent one by one to the UART in the background. The HRSOut command continues to function normally as indicated in the manual.

    The parameters that must be handled are the baud rate and the array size. The end there is not speed gains if too many bytes are sent. The code is prepared for several baude rates: 9600, 19200, 38400 & 57600. The timer used is Timer2 because it is very easy to manage with PR2 and needs small lines of codes to run.

    Some formula could be applied, if the number of Bytes to send is repetitive.
    YourProgramTimeLoop > numberBytesToSend x 10 / BaudRate
    For example: 100 bytes x 10 / 9600 = 0,104 the "YourProgramTimeLoop" must to be > 104 mS

    To be as efficient as possible, you can regularly distribute the number of interruptions in time the main program loop. Pulling out all the bytes at maximum speed in the beginning of his program could delay your main code. Carefully choose the baudrate, the dimension of the array depending on the number of bytes to send and runtime of the main program. Of course some testing is needed.

    Download the code HERE
  • Recent Activity


    PIC18F1330 PLL problem

    Thread Starter: rcurl

    I'm just starting out on a new project that uses a PIC18F1330. I haven't used this specific chip before, so I began by trying to blink an LED just...

    towlerg Yesterday, 16:26 Go to last post

    Pic16f18877 oread

    Thread Starter: evoortman

    Hi, On a PIC16F18877 the OREAD command doesn't seem to work. The code is working on a PIC16F1939. Both controllers use 32MHz int osc. If i...

    towlerg Yesterday, 16:25 Go to last post

    MID$ Problem with a PIC18F25K22

    Thread Starter: palamont

    Hi everybody, I encounter a strange problem : I have a string of 230 characters. This string is divided into 10 segments of 23 characters, with a...

    palamont Yesterday, 10:08 Go to last post