• PicŪ Basic


  • GetParity

    A library module for use withLibrary Manager by JohnGB. This module has been written by Tim Box (Tim on PDS forum). The library module is offered on an as-is basis with no warranty as to its effectiveness, operation or reliability. Users use it at their own risk.

    Adds a new command called GetParity

    Syntax

    Assignment Variable = GetParity (Variable)

    Overview

    Returns the parity of the Variable. 1 if parity is odd and 0 if parity is even.

    Operators

    Assignment Variable – A byte variable. Variable - a byte sized constant, or variable

    Code:
    Include "PROTON_4.INC"
    
        Dim ParityResult As Byte  
        Dim OutByte As Byte
    
        Symbol TX9D = TXSTA.0    ' 9th bit of transmit data. Can be parity bit.
        Symbol TX9 = TXSTA.6     ' 9-bit Transmit Enable
    
        TX9 = 1                  ' Enable 9 bit data  
    
        OutByte = 255
    
        ParityResult = GetParity OutByte
    
        TX9D = ParityResult      ' Load the 9th (parity) bit
    
        HRSOut OutByte
    
        Stop
    The example above will set up as 16f877 to transmit 9 bits of data setting bit 9 as the parity bit. Data is sent Parity Even

    Download module

    Download: Usart Tools Get Parity
  • Recent Activity

    towlerg-21522

    Mysterious PORTB problem

    Thread Starter: xldaedalus

    I'm using Proton+ to develop firmware for a product with switches. The MCU is an 18F26K22. Most of the switches reside on PORTB. I am NOT using a...

    towlerg Today, 15:45 Go to last post
    towlerg-21522

    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 Today, 19:19 Go to last post
    towlerg-21522

    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 Today, 15:59 Go to last post