Menu

System Variable names

cupl
2018-10-11
2018-10-11
  • cupl

    cupl - 2018-10-11

    Many apologies if I have missed it but I was wondering if there is a standard list of system/pre defined variables and how they can be used anywhere? I have just been generating a general purpose, well for me, multi channel PWM code using interrupts and was please to see TMR0, for instance, was easily incorporated into the code and set directly,. However there have been situations where I think I have mistakenly used a system variable and it has caused problems.

    Many Thanks

     
  • Chris Roper

    Chris Roper - 2018-10-11

    TMR0 is not a System Variable, it is an Internal Hardware Register.
    All of the Registers for any given device are listed in the *.dat file for that Device.
    The best source of register Names is actually the Data Sheet for the Device.

    These are Register Names for example:

    PORTA
    PORTB
    PORTC
    PORTD
    PORTE
    PORTF

    but, as only the largest of the PIC devices have 6 I/O Ports, the Datasheet will tell you which are available. On smaller devices the Port may be referred to as GPIO.

    There are a few system variables used by the compiler but they are not formally documented.

    Don't be intimidated by the datasheets, they are very useful and, as GCBASIC covers hundreds of Devices, the Datasheet is the most reliable documentation at Chip Level.

    Cheers
    Chris

     

    Last edit: Chris Roper 2018-10-11

Log in to post a comment.