In SX Microcontrollers, SX/B Compiler and SX-Key Tool, ringlord wrote: All-- Environment: SX28 at 4MHz on a PDB with a USB SX-Key and the 7.5v Parallax wall transformer. [b]PING))[/b] works fine for me and is amazingly accurate. My Parallax parallel 2x16 LCD works fine with the demo programs, including the modifications I make to them. The [b]servo[/b] is easy to use, although I probably do not understand it thoroughly. I can make [b]PING))[/b] work with the [b]LCD[/b]. I can make [b]PING))[/b] work with the [b]servo[/b]. I CANNOT make [b]PING))[/b] work with the [b]servo[/b] AND the [b]LCD[/b]. When the [b]servo[/b] works correctly, the [b]LCD[/b] displays garbage (seen in the first clip). When the [b]LCD[/b] works correctly, the [b]servo[/b] is highly stupid (seen in the second clip). By the way, you probably cannot read the LCD display in the second clip, but it is displaying the correct PING)) distance. My impression is that there are timing issues that prevent the LCD working with the servo code. I have attached the code plus two very short video clips of how it executes: [url=http://www.billcnkc.com/Robotics/01-11-10PingServoLCD-a.mpg][b][u]Servo Working[/u][/b] [/url]and [url=http://www.billcnkc.com/Robotics/01-11-10PingServoLCD-b.mpg][b][u]LCD Working[/u][/b][/url]. The only difference between the two video clips is shutting down the IDE, turning off the PDB, and removing and replacing the USB connection. Here is the meat of the code. (The entire code is attached.) Start: PLP_A = %0000 ' pull-ups on unused pins PLP_B = %1111_1110 PLP_C = %0000_0011 Lcd_Setup: DELAY_MS 500 ' let LCD self-init LCD_INIT ' initialize (multi-line) Main: for idx = 0 to pulses tmpB5 = idx/30 tmpB6 = __REMAINDER if tmpB6 = 0 then ' Ping every 0, 30, 60, and 90 pulses ' Ping . . . distance = GET_DISTANCE DELAY_MS 100 ' Send Distance to LCD . . . LCD_CMD LcdCls DELAY_MS 25 ' for effect LCD_STR "Distance: " LCD_DEC distance, 5 DELAY_MS 25 endif pulsout servo, 1000 DELAY_MS 20 next for idx = 0 to pulses tmpB5 = idx/30 tmpB6 = __REMAINDER if tmpB6 = 0 then ' Ping every 0, 30, 60, and 90 pulses ' Ping . . . distance = GET_DISTANCE DELAY_MS 100 ' Send Distance to LCD . . . LCD_CMD LcdCls DELAY_MS 25 ' for effect LCD_STR "Distance: " LCD_DEC distance, 5 DELAY_MS 25 endif pulsout servo, 500 DELAY_MS 20 next GOTO Main I sure would appreciate any comments you might have. Thanks! --Bill ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=417151 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2010 (http://www.dotNetBB.com)