• PicŪ Basic


  • Number of Cycles

    If you want to know the number of cycles it takes to perform a task on a PICŪ the following gives an example...

    INCLUDE "PROTON_G20.INT" 'Proton 20MHz Graphics LCD
    DIM TIMER1 AS TMR1L.WORD 'See help file
    DIM X AS FLOAT
    DIM Y AS FLOAT 'Dim some FLOATS
    DIM Z AS FLOAT

    DELAYMS 500 'Give PICŪ a chance to wake-up

    CLS 'Clear the GLCD

    X = 1234.321 'Load 1234.321 into X FLOAT
    Y = 3.33 'Load 3.33 into Y FLOAT

    CLEAR TIMER1 'Clear TIMER1
    '#########################
    T1CON = %00000001 'Enable the Timer

    Z = X * Y 'Code to calculate

    T1CON = %00000000 'Stop the Timer
    '#########################

    PRINT AT 0,0,"CYCLES ",DEC TIMER1 'Print out the number of Cycles
    PRINT AT 2,0,"ANSWER ",DEC Z 'Print out Answer
    END
    contributed by RON
  • Recent Activity

    teo-16018

    Microsoft security essentials blues

    Thread Starter: shantanu@india

    Hi, A strange thing happened just now.My Windows 7 Micrsoft Sercurity Essentials suddenly gave a warning that prplus.exe(Compiler) is a potential...

    teo Today, 19:23 Go to last post
    barak-1433

    SPI mssp

    Thread Starter: picprotonguy

    Just ordered Digital to Analog IC MCP4822 with SPI interface and immediately opened proton manual. I'm very disappointed, it looks like Proton...

    barak Today, 22:50 Go to last post
    David Barker-251

    UMC bootloader 18F46K22

    Thread Starter: shunt010

    Hi all. I am trying to build a UMC bootloader file for the 18F46K22, and it doesn't appear to work. It returns (in the error log) Error ...

    David Barker Today, 11:20 Go to last post