SHIFTOUT
 
Syntax

void SHIFTOUT (int out_pin, int clk_pin, int mode, int cnt , int *wordList, int bitLengths) ;
Description

SHIFTOUT has been kept as a compatable function with PBASIC.  It can be used for devices that are not covered by SPI, I2C or 1-Wire. Data is placed on out_pin and the clk_pin is pulsed each bit.

While most other hardware functions use bytes, SHIFTOUT is oriented for bit control.  The length of each variable defines the number of bits that will be shifted out (2 - 32).  For each element bitLengths bits are shifted out.

SHIFTOUT uses values from the interger array wordList.  cnt integers will be shifted out.

Data is shifted out of the device at 800 Kbits/sec.


Example



    printf("FPU SHIFT test\n");     for (i= 0; i<10; i++) wordMessage[i]= 0xFF;
    wordMessage [i] = 0;
    SHIFTOUT (14,15,MSBFIRST,11,wordMessage, 8); // reset FPU
    WAIT (10);    wordMessage [0] = 0xF0;       // sync character
    SHIFTOUT (14,15,MSBFIRST,1,wordMessage, 8);  // sync FPU
    save_time = TIMER;
    while ((TIMER - save_time) < 15) ;    // wait 15 uSec
    
    SHIFTIN (14,15, MSBPRE,  1,wordMessage, 8);  // get 1 byte status back
    if (wordMessage[0] != 0x5C) {
     printf("%x No FPU found\n",shortResponse[0]);      break;
    }
    printf("FPU found\n");

See also