assigning register bits to an array?


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    Alistair

    After close examination and some digging, I find the LCD on this board (datasheet attached) is a 1/4 multiplexed display. This is done to keep the number of pins to a minimum, but boy, is it going to be fun to program! This is intriguing to me, because that infers I can use a 16f913 with this display.
    Now all I have to do is find a place to buy it!

    Dave
    Attached Images Attached Images

  2. #2


    Did you find this post helpful? Yes | No

    Default

    from the link posted by joe s i did some digging around and i came accreoo this little gem from Ingvar

    x var byte
    i var byte

    main:
    for i = 0 to 3
    ' a b c d
    ' 0 6 4 2
    LOOKUP i, [0,14,20,26], x
    porta.0[x]=1
    PAUSE 1000
    porta.0[x]=0
    PAUSE 300
    next i


    from this thread http://www.picbasic.co.uk/forum/showthread.php?t=4074

    Which is using a look up table to (undocumented feature) offset address a port bit off a register. they are talking about relays but i'm going to have a go for lcddata register bit addressing

    Thanks to all for your help

    Alastair

  3. #3


    Did you find this post helpful? Yes | No

    Default

    this works passing a bit pattern to individual bits as long as you know the bit offset from a register

    in my case using register LCDDATA

    ' lcd setup
    lcdcon = %11111111 'control register
    lcdse0 = %11111111
    lcdse1 = %11111111
    lcdse2 = %11111111 'choose all pins for lcd use
    lcdps = %00000000 'clock control, 0 is static


    i var byte
    x var byte
    set var byte


    main:
    'display charactor '0' on 1st segment
    for i= 0 to 6
    lookup i, [22,23,71,94,70,46,47], x '1st 7-segments offsets
    lookup i, [1,1,1,1,1,1,1,0],set 'set character '0'
    LCDDATA0.0[x] = set 'display it
    next i
    pause 500 'some time to see it

    'display charactor '4' on 1st segment
    for i= 0 to 6
    lookup i, [22,23,71,94,70,46,47],x '1st 7-segment
    lookup i, [0,1,1,0,0,1,1],set 'set character '4'
    LCDDATA0.0[x] = set 'display it
    next i
    pause 500 'some time to see it

    goto main

    -------------------------------------------------
    With this my origional question answered, thanks to all

    alastair

Similar Threads

  1. Bits, Bytes Words and Arrays
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 24
    Last Post: - 14th June 2016, 07:55
  2. Active low input?
    By CosMecc in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 8th August 2010, 20:31
  3. PIC16F877A pwm use for IR transmission
    By mcbeasleyjr in forum General
    Replies: 0
    Last Post: - 11th July 2009, 18:51
  4. Replies: 14
    Last Post: - 26th September 2007, 05:41
  5. error on compiling
    By parker in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 16th June 2005, 14:31

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts