In SX Microcontrollers, SX/B Compiler and SX-Key Tool, bean wrote: Jon is correct. The bit position must be a constant when using the SETB instruction. Here is how I would do it [code] DEVICE SX28, TURBO, STACKX, OSC4MHZ IRC_CAL IRC_4MHZ FREQ 4_000_000 RESET Start ;************************ Program Variables ***************************** org $08 ;First register address in main memory ;bank TestByte ds 1 ;Temporary storage BitLocation ds 1 ;Bit location within TestByte org $100 Start break mov BitLocation,#$80 ;location of bit to be set in TestByte mov TestByte,#$00 ;Initial value = 0 clc ;clear carry so we shift a zero on the first shift Main or TestByte,BitLocation ; Set the bit rr BitLocation ; Adjust so next bit is a "1" jnc Main ; Quit when the "1" bit gets shifted out to the carry bit jmp $ ; Stop here [/code] Bean ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=253261#m253362 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)