when i use: pulsin portf.0, 5
it should put pin f.0 high for .005 seconds right??? i am really realizing how much i dont know about this stuff. most of my robots have been made by trying different code until it works. on this one, i am learning a little more code but i still dont know how all this works..
heres the code:
DEFINE OSC 20
TRISF.1 = 0
'variables
'----------------------------------------------------------------------------------
baudLCD CON 32 'baud rate for lcd
lcd VAR PORTF.0 'lcd port
ping VAR WORD
ultra VAR PORTF.1
Low PORTF.1
High PORTF.0
ping = 0
'Startup Program
'-------------------------------------------------------------------------------------- 'start motor driver
Pause 3000 'pause for LCD startup screen 'reset motor driver 'wait a few seconds
SerOut2 lcd, baudlcd,[254,"X"] 'clear screen
Pause 100
SerOut2 lcd, baudlcd,[254,"X"] 'clear screen again
SerOut2 lcd, baudlcd,[254,"P",140] 'change resolution
SerOut2 lcd, baudlcd,[254,71,1,1,"Ping Test"] 'display test on lcd in position 1,1
'main program
'----------------------------------------------------------------------------------------
start:
PulsOut ultra, 5 'send trigger to ping
PulsIn ultra, 1, ping 'wait for ping variable
Pause 1000
SerOut2 lcd, baudlcd,[254,71,5,3,DEC ping," "]
Pause 1000
GoTo start
End
and heres a video or whats happening...
http://s163.photobucket.com/albums/t...adbotultra.flv
unfortunately, its not easy to see the LCD screen, so it may not help much
thanks for all the help...




Bookmarks