In SX Microcontrollers, SX/B Compiler and SX-Key Tool, John Bond wrote:
[3]Hi Guys[/3]
[3] [/3]
[3]PLEASE HELP!!![/3]
[3] [/3]
[3]I am trying to pass a byte from an SX28 to an SX48 development board using the Shift-Out and Shift-In commands. I can't get it to work.[/3]
[3] [/3]
[3]What am I doing wrong.[/3]
[3] [/3]
[3] [/3]
[3]From>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[/3]
[3]DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX[/3]
[3]FREQ 4_000_000[/3]
[3] [/3]
[3]Dpin VAR RA.0 ' shift data[/3]
[3]Cpin VAR RA.1 ' shift clock[/3]
[3]Latch VAR RA.2 ' latch outputs[/3]
[3]LED VAR RB.0[/3]
[3] [/3]
[3]temp1 VAR Byte[/3]
[3]ShiftChar VAR Byte[/3]
[3] [/3]
[3]watch counter, 8, udec[/3]
[3] [/3]
[3]' ====================================================[/3]
[3] PROGRAM Start[/3]
[3]' ====================================================[/3]
[3] [/3]
[3]' --------------------------------------------------[/3]
[3]' Subroutine Declarations[/3]
[3]' -------------------------------------------------[/3]
[3]ShiftItOut SUB 1 ' pass value out[/3]
[3] [/3]
[3]Start:[/3]
[3]ShiftChar = 123[/3]
[3] [/3]
[3]TRIS_B = %00000000 [/3]
[3] [/3]
[3]Main:[/3]
[3] [/3]
[3] ShiftItout ShiftChar ' transfer data[/3]
[3]break [/3]
[3] [/3]
[3] [/3]
[3] toggle LED[/3]
[3] pause 20[/3]
[3] [/3]
[3]GOTO main[/3]
[3] [/3]
[3] [/3]
[3]ShiftItout:[/3]
[3] temp1 = __PARAM1 ' capture value[/3]
[3] SHIFTOUT Dpin, Cpin, 0, temp1 ' send the bits[/3]
[3] PULSOUT Latch, 2 ' transfer to outputs[/3]
[3] RETURN[/3]
[3] [/3]
[3] [/3]
[3][/3]
[3][/3]
[3] [/3]
[3]To>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[/3]
[3]DEVICE SX48, OSC4MHZ, [/3]
[3]FREQ 4_000_000[/3]
[3] [/3]
[3] [/3]
[3]Dpin VAR RA.1 ' shift data[/3]
[3]Cpin VAR RA.2 ' shift clock[/3]
[3]Latch VAR RA.3 ' latch outputs[/3]
[3] [/3]
[3]temp1 VAR Byte[/3]
[3] [/3]
[3] [/3]
[3]watch temp1, 8, udec[/3]
[3] [/3]
[3]' ===================================================[/3]
[3] PROGRAM Start[/3]
[3]' ===================================================\[/3]
[3]Start:[/3]
[3] [/3]
[3]TRIS_A = %11111111[/3]
[3] [/3]
[3]Main:[/3]
[3] [/3]
[3]SHIFTIN DPin, CPin, 0, temp1[/3]
[3]break [/3]
[3] [/3]
[3]GOTO main[/3]
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=170891
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)