How you directly access serially chained devices, like LEDS, shift registers, etc?


+ Reply to Thread
Results 1 to 20 of 20
  1. #1
    Join Date
    Feb 2013
    Posts
    860

    Default How you directly access serially chained devices, like LEDS, shift registers, etc?

    Hello.

    I connected 6 pieces of APA102C to 16F886 and they all work fine, control appears to be quite straightforward and simple:

    SHIFTOUT di, ci, 1, [%00000000,%00000000,%00000000,%00000000] - to initialize transfer and then
    SHIFTOUT di, ci, 1, [%11111111,B,G,R] - enables 1st led in a row at color defined with BGR values and common brightness register value.

    The issue I see, is that I want to illuminate say led #4, I have to keep in 6 variables values for all leds, and actually "redraw" the whole led string. Or another solution is, to have array with length of the led string attached, update data in it, and have one common "refresh" routine, which reads data in array and updates it all at once. But both this methods will be significantly slow, in case of say 150 or more leds, since shiftout is software routine, and when I tried to do scrolling marque with 4x MAX7219 8x8 led matrices, the slow redraw speed was quite noticeable.

    So are there any other, more efficient and faster ways, so say if I want to update led #240, in 256 led string, won't have to "redraw" the complete led string.

  2. #2
    Join Date
    Apr 2014
    Location
    Northeast
    Posts
    486


    Did you find this post helpful? Yes | No

    Default Re: How you directly access serially chained devices, like LEDS, shift registers, etc

    From what I've read, if you're running 256 LEDs, you get them where you want them now, but to change #240 requires shooting out 256 color commands. Is this your only option, or might there be another alternative to achieve your goals? You haven't really stated what you're building, just what your intended approach is. As far as the 256 Variables, if you're running into Memory shortages, you could try a newer PIC with more Memory.

  3. #3
    Join Date
    Feb 2013
    Posts
    860


    Did you find this post helpful? Yes | No

    Default Re: How you directly access serially chained devices, like LEDS, shift registers, etc

    Actually, I'm not doing anything so far, just in future, I want to make a small RGB display, 192 X 12 pixels, using these LEDs. My experience with 64x8 LED displays, based on 4 x MAX7219 was not so good, because this "serial" method of needing to update everything at each time, required complete re-send of data to display, which was quite lagging, and won't allow to do some cool animation or smooth scrolling.

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,090


    Did you find this post helpful? Yes | No

    Default Re: How you directly access serially chained devices, like LEDS, shift registers, etc

    18F46K40 can run at least 4 of these 16x32 [512led] modules, possibly 6
    @25 fps(as a back ground task)


    two colour



    full 24bit rgb on esp8266
    Last edited by richard; - 22nd January 2022 at 10:11.
    Warning I'm not a teacher , prose like a gushing embroilment is not my style

  5. #5
    Join Date
    Feb 2013
    Posts
    860


    Did you find this post helpful? Yes | No

    Default Re: How you directly access serially chained devices, like LEDS, shift registers, etc

    It is not about what can run what, it is about efficiency.
    As another solution, I think, led decoders like HT16K33+discrete RGB LED or similar can be used.
    With APA102C, 1 shiftout statement updates color of 1 pixel (3 leds )
    In case of HT16K33, 3 shiftout statement will update color of 8 pixels (24 leds), so resulting speed will be 8/3=2.6 times higher.
    So I'm seeking for solution in that way.
    Of course, there are specialized RGB display modules and controllers, but their issue is, that they either have gigantic brightness, or their pixel distance is very sparse. And I want to make compact display for indoor use - discrete RGB leds are available in 0805 package, and APA102C/WS2812 are available in 1206 package.

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,090


    Did you find this post helpful? Yes | No

    Default Re: How you directly access serially chained devices, like LEDS, shift registers, etc

    With APA102C, 1 shiftout statement updates color of 1 pixel (3 leds )
    In case of HT16K33, 3 shiftout statement will update color of 8 pixels (24 leds), so resulting speed will be 8/3=2.6 times higher.
    apa102 16million colours, 32 level global power control
    HT16K33 8 colours no power control

    dmd panels come in p2.5 p3 etc to p10 the number is the pixel grid spacing in mm
    dmd panels are just shift registers multiplexed in 4 row pair strings there is no controller as such

    if you want the complexity of colour and power level control on a per pixel basis you need to store and transfer
    the info to represent it, there is no simple
    Warning I'm not a teacher , prose like a gushing embroilment is not my style

  7. #7
    Join Date
    Feb 2013
    Posts
    860


    Did you find this post helpful? Yes | No

    Default Re: How you directly access serially chained devices, like LEDS, shift registers, etc

    ht16k33 was just an example, note the "or similar" in my post - I don't exactly remember which holtek chip has individual brightness control, but there are some, they're installed in these commercial color rgb panels.

    Yes, 2.5mm spacing, that is huge in 2.5 x 2.5 mm area, where you will have 4 RGB pixels, with SMT leds, you can have 3x3 or even 4x4 RGB pixels.

  8. #8
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,414


    Did you find this post helpful? Yes | No

    Default Re: How you directly access serially chained devices, like LEDS, shift registers, etc

    Since the LEDs effectively ARE shift registers daisychained together there is no way to update a single LED, you doneed to refresh the complete string. But if you design a 192x12 display you could, for example have 12 separate strings of 192 leds so that you could update the display row by row - if that helps.

    You'll need a PIC with lots of RAM though, 192x12x3=6912 bytes to hold the display data.

    And, since you talk about efficiency, forget SHIFTOUT and start using the MSSP module or the SPI module on the newer PICs instead.

  9. #9
    Join Date
    May 2013
    Location
    australia
    Posts
    2,090


    Did you find this post helpful? Yes | No

    Default Re: How you directly access serially chained devices, like LEDS, shift registers, etc

    192x12x3=6912 bits == 864 bytes

    Warning I'm not a teacher , prose like a gushing embroilment is not my style

  10. #10
    Join Date
    Feb 2013
    Posts
    860


    Did you find this post helpful? Yes | No

    Default Re: How you directly access serially chained devices, like LEDS, shift registers, etc

    Each color value is 8 bit, so it is 6912 bytes, not bits But that's ok, I'll use external EEPROM as display buffer.
    MSSP would be great, but no PBP support as far as I know - need to use ASM....

  11. #11
    Join Date
    May 2013
    Location
    australia
    Posts
    2,090


    Did you find this post helpful? Yes | No

    Default Re: How you directly access serially chained devices, like LEDS, shift registers, etc

    it would be difficult to pack rgb leds more tightly than these
    p3 64x64 p4 32x64 modules
    Name:  p4.jpg
Views: 107
Size:  268.3 KB
    Name:  p3.jpg
Views: 103
Size:  220.3 KB


    and they work, limited to 8 colours with pbp
    Warning I'm not a teacher , prose like a gushing embroilment is not my style

  12. #12
    Join Date
    Feb 2013
    Posts
    860


    Did you find this post helpful? Yes | No

    Default Re: How you directly access serially chained devices, like LEDS, shift registers, etc

    Yes, bottom ones are 3030 leds. And they're placed sparsely.
    Now check footprint of 1206 or 0805 enclosure and compare sizes

  13. #13
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,414


    Did you find this post helpful? Yes | No

    Default Re: How you directly access serially chained devices, like LEDS, shift registers, etc

    Quote Originally Posted by CuriousOne View Post
    Each color value is 8 bit, so it is 6912 bytes, not bits But that's ok, I'll use external EEPROM as display buffer.
    MSSP would be great, but no PBP support as far as I know - need to use ASM....
    Say what? You start the thread about efficiency and then you're going to use external memory as display buffer?

    There is zero need for any assembly code to operate the MMSP module (or the SPI module on the Q devices for that matter).

  14. #14


    Did you find this post helpful? Yes | No

    Default Re: How you directly access serially chained devices, like LEDS, shift registers, etc

    If you just need more RAM for a display buffer there are much faster devices than an external EEPROM, like the 23LC512 serial SPI SRAM.
    Also, since SHIFTOUT runs at approx 50KHz, you could even write your own dedicated version that would be MUCH faster than that, although using the MSSP/SPI peripheral is pretty straight forward and would easily get you into the multi-MHz range.

  15. #15
    Join Date
    Feb 2013
    Posts
    860


    Did you find this post helpful? Yes | No

    Default Re: How you directly access serially chained devices, like LEDS, shift registers, etc

    Where I can learn about that MSSP in PBP ?

  16. #16
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,233


    Did you find this post helpful? Yes | No

    Default Re: How you directly access serially chained devices, like LEDS, shift registers, etc

    On the Data Sheet of each PIC you will use. You learn the ins and outs of the sub section of the PIC and the registers that you have to manipulate directly.

    PBP had nothing to do with the MSSP/SPI section other than setting bits in the registers.

    Ioannis

  17. #17
    Join Date
    Feb 2013
    Posts
    860


    Did you find this post helpful? Yes | No

    Default Re: How you directly access serially chained devices, like LEDS, shift registers, etc

    Well someone above, called Henrik , said that PBP is supporting it directly, this is why I asked

  18. #18
    Join Date
    Apr 2014
    Location
    Northeast
    Posts
    486


    Did you find this post helpful? Yes | No

    Default Re: How you directly access serially chained devices, like LEDS, shift registers, etc

    If you go to Microchip.com and type MSSP or SPI or I2C into the Search window, then click on Application Notes in the left column, there are numerous Application Notes on how these peripherals function, and how to put them to use. Code is usually in ASM and/or C, but the concepts are outlined extremely well.

  19. #19
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,414


    Did you find this post helpful? Yes | No

    Default Re: How you directly access serially chained devices, like LEDS, shift registers, etc

    I did not say PBP have high level commands to drive your specific device using the MSSP module - no - I said you don't need any assembly language to use the MSSP module.

    You configure the module by writing values to a couple of registers. (Should it run in SPI or I2C mode, what clock frequency, MSB/LSB first and so on). It's the same procedure as configuring an I/O for the correct mode by setting TRIS and ANSEL or to select what clock source to use for the ADC by writing to ADCONx (or whatever). But if you're not prepared to read a couple of pages in the datasheet then forget it and stick with SHIFTOUT.

    Sometimes users seems to think that TRIS, CMCON, ANSEL, ADCON and what not are commands - they are not. They are registers in the PIC to which can write by simply assigning a value to them, TRISA=127 or read myVar = CMCON. That's as basic as it gets and doing that to a few registers are all it takes to configure the MSSP module. Sending a byte is then as simple as writing said byte to another registers and out it goes. Again, just take 1h and READ the datasheet.

  20. #20
    Join Date
    May 2013
    Location
    australia
    Posts
    2,090


    Did you find this post helpful? Yes | No

    Default Re: How you directly access serially chained devices, like LEDS, shift registers, etc

    is your google broken

    "site: picbasic.co.uk/forum/ spi"

    "site: picbasic.co.uk/forum/ mssp"
    Warning I'm not a teacher , prose like a gushing embroilment is not my style

Similar Threads

  1. LCD's with Shift Registers, and LCDOUT
    By Darrel Taylor in forum PBP Extensions
    Replies: 11
    Last Post: - 3rd April 2015, 14:34
  2. Smart Star (how to use shift registers)
    By mackrackit in forum Code Examples
    Replies: 3
    Last Post: - 30th November 2008, 20:06
  3. Use the PIC 16f877 or 877A instead of shift registers.
    By tsanders in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th October 2006, 17:23
  4. Shift Registers
    By shahidali55 in forum General
    Replies: 2
    Last Post: - 7th September 2006, 20:07
  5. Shift Registers For LCD Display
    By jetpr in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 7th July 2006, 15:03

Posting Permissions

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