In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Professorwiz wrote: Hello, I've been using PBasic and have just been going though my programs making them work with the SX, I've changed a simple one that flashes a couple led going though a transistor, and one just going though a 470ohm resistor. The problem is I have 2 programs and one works and one doesn't and I can't see why the 1st doesn't. My schematic is attached for the pin with the transistor. Can anyone tell me what I'm overlooking? Program 1: ' ------------------------------------------------------------------------- ' Device Settings ' ------------------------------------------------------------------------- DEVICE SX28, OSCHS3, TURBO, STACKX, OPTIONX IRC_CAL IRC_SLOW FREQ 5_000_000 PROGRAM start_point ' ------------------------------------------------------------------------- ' IO Pins ' ------------------------------------------------------------------------- 'pin0 to transistor and 3 leds 'pin1 to resistor and 1 led ' ------------------------------------------------------------------------- ' Variables ' ------------------------------------------------------------------------- ctn var byte ' ------------------------------------------------------------------------- TRIS_B=0 RB=0 ' ------------------------------------------------------------------------- ' PROGRAM CODE ' ------------------------------------------------------------------------- start_point: for ctn =1 to 10 RB=%00000000 pause 100 RB=%11111111 pause 100 next goto start_point [b]Program #2[/b] ' ========================================================================= ' ' File...... TEMPLATE.SXB ' Purpose... SX/B Programming Template ' Author.... ' E-mail.... ' Started... ' Updated... ' ' ========================================================================= ' ------------------------------------------------------------------------- ' Program Description ' ------------------------------------------------------------------------- ' ------------------------------------------------------------------------- ' Device Settings ' ------------------------------------------------------------------------- DEVICE SX28, OSCHS3, TURBO, STACKX, OPTIONX IRC_CAL IRC_SLOW FREQ 5_000_000 PROGRAM start_point ' ------------------------------------------------------------------------- ' IO Pins ' ------------------------------------------------------------------------- 'Pin0 to transistor and 3leds 'Pin1 to resistor and 1 led ' Variables ' ------------------------------------------------------------------------- CNT VAR BYTE spd var byte ' ------------------------------------------------------------------------- ' INTERRUPT ' ------------------------------------------------------------------------- ' Program Code ' ------------------------------------------------------------------------- start_point: spd = 10 TRIS_B=0 RB=0 FOR CNT = 1 TO 250 RB=%01111110 PAUSE spd RB=%11111101 PAUSE spd NEXT goto start_point ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=192862 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)