• PicŪ Basic


  • Masking pins

    A PORT usually have 8 output / input pins. Sometimes we need to `scan' a PORT to check which pins are high and which pins are low.

    Code:
    Dim Temp as Byte
     
    Temp = PORTB
    Temp will return a decimal value according to the logic binary of that PORT. What happens when we need to `scan' only the first 4 pins of a PORT or whatever pins on a PORT depending on the wiring and you need to use the rest as input or outputs?

    If the required pins are not masked, then all the PORT will be read, and a wrong value will be read depending on what state the `not scaned' pins are. If you mask a part of a PORT, then you only read the pins you have masked.

    I found a thread which is very useful when it comes to mask pins of a PORT. Follow this link to see how masking can be done.

    http://www.protonbasic.co.uk/showthr...011#post454011

    Joseph
  • 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
    pic-ignorant-1162

    Proton Runtime Error

    Thread Starter: Paulcc

    I have proton running well on my laptop, but after installing it on my desktop, I get the following runtime error: "Runtime Error 217 at 000709FC" I...

    pic-ignorant Yesterday, 22:11 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
    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, 16:06 Go to last post