Shop OBEX P1 Docs P2 Docs Learn Events
SX/B and BS2 SHIFTOUT commands act different ?? — Parallax Forums

SX/B and BS2 SHIFTOUT commands act different ??

T&E EngineerT&E Engineer Posts: 1,396
edited 2007-06-08 21:48 in General Discussion
I have written a program (although not complete for the BS2) that connects to an AD-801-B 16x32 LED matrix. It uses 3· Serial In· LED driver chips much like the 595 in some ways. The first 16 bit shift register LED driver (LC7932M) controls the rows 1-16 and the remaining 2 LED drivers (LC7932M) on the AD-801-B drive the 32 columns.

The BS2 program strangely starts sequencing 1 LED on/off starting at the 9th row, 1st column to the 8th column. Then the program sequences the LED on/off on the 16th row, but at the 16th to the 23rd column. I can not get them to cycle across all 16 columns (nor all 16 rows - EXCEPT IN THE SX/B program). All that is really different is the use of the \BITs optional command (BS2) or \COUNT optional command (SX/B) for the SHIFTOUT command. On the BS2, if I use the \16 (for 16 bits output) the display is blank.

However, in the SX/B version i can use the \16 command the output is quite different better in someways.

In the SX/B program I see all 16 rows ON starting at column 1 and it sequences the LED on/off accross all 32 columns. However, when entering in a value for SIN_1 (that controls the rows),...all the row LEDs turn on in the particular column. I can change the pattern on the columns to whatever I want and it does work but on the rows it only works with 1 or values not related to 2, 4, 8, 16. It is weird.

Why are the displays so radically different between the BS2 version and the SX/B version?

BS2

ooooooooooooooooxxxxxxxxxxxxxxxx
oooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooo
xxxxxxxxxxxxxxxxoooooooooooooooo
oooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooo

The "x"s turn on and off starting at row 9, col 1 to row 16, col 16.


SX/B

xooooooooooooooooooooooooooooooo
xooooooooooooooooooooooooooooooo
xooooooooooooooooooooooooooooooo
xooooooooooooooooooooooooooooooo
xooooooooooooooooooooooooooooooo
xooooooooooooooooooooooooooooooo
xooooooooooooooooooooooooooooooo
xooooooooooooooooooooooooooooooo
xooooooooooooooooooooooooooooooo
xooooooooooooooooooooooooooooooo
xooooooooooooooooooooooooooooooo
xooooooooooooooooooooooooooooooo
xooooooooooooooooooooooooooooooo
xooooooooooooooooooooooooooooooo
xooooooooooooooooooooooooooooooo
xooooooooooooooooooooooooooooooo

x -> sequences in an up/down column all the way across.

Any explainations of what's happening here?


Post Edited (T&E Engineer) : 6/3/2007 11:21:51 PM GMT

Comments

  • BeanBean Posts: 8,129
    edited 2007-06-04 12:50
    I suspect that the "\16" is causing some kind of problem in the SX/B program. Does the SX/B work the same if you use 2 shiftout lines with no "\" option ?

    I think someone else mentioned something about the "\" option with shiftout. I will investigate the problem.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    “The United States is a nation of laws -· poorly written and randomly enforced.” - Frank Zappa

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.hittconsulting.com
    ·
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-06-04 13:49
    No without the \ option·I beleive it only shows·the first 8 rows scanning across the columns but has some other oddities in that·at columns 17 it flashes a square of LEDs very briefly. But I need to verify this again and will get back.

    What is strange is how differently it does not work as to what I would think under BS2 SHIFTOUT. I will try to post a couple of You Tube video's tonight if I can.


    Thanks.
  • DosManDanDosManDan Posts: 179
    edited 2007-06-04 18:16
    Yes, I recently came across this issue too. In reading the help file, it mentions it will only shift up to 8 bits. So, I don't think \16 works correctly. I broke mine up using LSB and MSB now everything works the way it should. Possibly this might help.

    Dan
  • BeanBean Posts: 8,129
    edited 2007-06-04 18:51
    I think the problem is if you specify MSBFIRST then use \4 should it send bits 15,14,13,12 or bits 3,2,1,0 ?
    Does anyone know off hand how the BS2 handles this ?


    [noparse][[/noparse]edit] It looks like SX/B sends bits 3,2,1,0 in this situation. It also assume \8 even if a WORD variable is specified. I'll have to check maybe the BS2 sends the high order bits, that could cause the difference in function.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    “The United States is a nation of laws -· poorly written and randomly enforced.” - Frank Zappa

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.hittconsulting.com


    Post Edited (Bean (Hitt Consulting)) : 6/4/2007 7:02:35 PM GMT
  • JonnyMacJonnyMac Posts: 9,214
    edited 2007-06-04 19:49
    If you specify 4 bits with the BS2 you get bits 3, 2, 1, and 0. If you want to shift the high nib out you'd have to do a SWAP or shift right to right-align the bits so that your desired LSB is positioned at bit0.

    Post Edited (JonnyMac) : 6/4/2007 10:30:00 PM GMT
  • DosManDanDosManDan Posts: 179
    edited 2007-06-04 21:51
    The BS\2 will send 16 bits, but the SX will only send 8, even if you specify 16. You can change the order the bits are sent by using the LSBPRE, MSBPRE and LSBPOST, MSBPOST modifiers(for the SX).

    Dan
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-06-04 23:04
    What's strange about this is that the BS2 appears to only display 8 LEDs at a time but the SX/B displays 16 so something is not right in my code. If I try to use the \16 command in the BS2 program I get no display (I believe - but need to recheck again).
  • BeanBean Posts: 8,129
    edited 2007-06-05 11:56
    Jon,
    · Thanks for setting me straight about the BS2 shiftout.

    Dan,
    · Are you using the latest version (1.51.03) ? I just checked a shiftout with \16 and it seems to be outputting 16 bits just fine.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    “The United States is a nation of laws -· poorly written and randomly enforced.” - Frank Zappa

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.hittconsulting.com


    Post Edited (Bean (Hitt Consulting)) : 6/5/2007 12:27:00 PM GMT
  • DosManDanDosManDan Posts: 179
    edited 2007-06-06 04:53
    Bean,
    At the risk of sounding dumb, I looked all over the software and couldn't find the version for SX/B. I'm on SxKey 3.2. Looks like I need to download the latest stuff (3.2.3). The help file for SX/B had a version 1.42.01 17 Oct 2005. I'd swear I downloaded your latest help file...guess I was wrong.


    Update:
    OK, have the latest stuff, but the Help File states SHIFTIN accepts a parameter from 1-8 specifying the number of bits to input. Can it be more than 8?

    Dan

    Post Edited (DosManDan) : 6/6/2007 5:28:41 AM GMT
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-06-08 01:28
    I have made some progress with both the BS2 and SX-28 versions of my program and got it to work except when using SHIFTOUT statements in either PBASIC or SX/B. I haven't got a clue why this is not working but at least I can do it manually.

    If someone could please look over my SX/B program and tell me how I can read in the data2 and data3 statement in using probably READINC statements, it would be appreciated. I tried and it did not work right at all.

    I have also included the PBASIC version of the program to show how a BitIndex Function routine written by JonnyMac saved alot of code duplication at least in SX/B. Very nice and thanks to JonnyMac for his Function routine.

    There must be an easier way to reduce all of the data2 and data3 statements into READINC and DATA statements. I have already put them into dat2 and dat3 DATA statements for your convinience.

    Thanks!
  • JonnyMacJonnyMac Posts: 9,214
    edited 2007-06-08 04:17
    Even though SX/B doesn't have a WREAD instruction to compliment WDATA (which you should use with 16-bit values), there's no reason why you can't code your own WREAD function -- the attached program (which has been tested and works) shows how. Run the program in Debug mode.

    Post Edited (JonnyMac) : 6/8/2007 4:44:26 AM GMT
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-06-08 10:43
    Thank you JonnyMac. I totally forgot that my DATA was 16 bit values (Word). I will implement your routine or some variation of it tonight.



    Thanks again. You always come through for me and so fast too!
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-06-08 21:48
    Thank you JonnyMac. Your function routines worked great in my program·and really reduced the program size down. I will next look into an interupt (like used in my RTC scrolling clock program) to speed up the displace scrolling a bit. I have attached the updated program.

    Thanks again!
Sign In or Register to comment.