Hello,
I need to disable and enable hserial interrupt because software serial I/O lost bit when data is received on hardware serial.
-> disablehserial / disable HSERIALINT_???
how i can make this ?
Please help me.
Pascal
Hello,
I need to disable and enable hserial interrupt because software serial I/O lost bit when data is received on hardware serial.
-> disablehserial / disable HSERIALINT_???
how i can make this ?
Please help me.
Pascal
You won’t fix your problem by disabling the hardware serial interrupts. You will just be changing what is getting screwed up. The hardware serial interrupts that “drive” hserial only run while data is either being sent or received. Any other time they will not run and hence will have no effect on software serial commands.
Just to be clear what I’m saying is you will either lose data when the hserial commands are disabled or you don’t need to disable them and just need to wait until they are not running(sending or receiving data) to run your software serial commands. Maybe you should give a little more detail on exactly what you need to do in your program(eg why do you need to use software serial and hardware serial at the same time).
Hardware UART is The primary command input of WiFi robot.
Software serial lines is for all sensors, motor or servo controlers etc. USED IN BACKGROUND.
-> If bytes is received by UART interrupt WHEN serin/out is in progress -> some BYTES CORRUPT on soft serial I/O:(
My project is complicated to explain because I have bad english
I solve my problem but is a workaround -> SAME speed on soft and hard serial work (19200 bauds) = No data corruption on serial I/O:)
Now all work perfectly:)
My program schematics is :
daemon
if pointer = 0 then ' only exec daemon task if no command receive in progress...
[hardware timer survey/test] survey sensors and execute autonomous robot task, battery check etc, etc...
[hardware timer survey/test] screen (serial vfd) display update
[hardware timer survey/test] misk high priority task...
[hardware timer survey/test] or misk low priority task...
endif
hserin 0, daemon, [commande(pointeur)] ' READ ONE BYTE FROM FIFO
if commande(pointeur) = 10 or pointeur = 127 then ' IF Line Feed or full
disable timerwint_imiea ' disable timer for serial I/O
gosub execute ' execute user command send from APACHE/HTTP+PHP SERVER
enable timerwint_imiea
commande = rep 0\128 'clear command buffer
pointer = 0 'reset pointer
else
pointer = pointer + 1 ' next byte
endif
goto daemon
execute
'many code here with SOFT SERIAL I/O to sensors, PID motor controler, SSC-32...
return
My robot can :
-Execute user command (read compas, read analog, IR scanner, move robot, move arm, move camera, move luxeon projector, send raw data to SSC-32, send data to VFD screen, change relay state, follow current line, go to charge station, compass live&background “autopilot”, more and more all is possible…)
-Buffer next user command if robot is busy:)
-Multitask for live sensor survey (Sample : Drive motor controler from user command is live corrected by the compass! If low battery -> Alert, If to many amps on motor controler STOP, scroll the VFD display)…
-The robot is simple TCP/IP ASCII TELNET server, controled by PHP on my webserver.
Full code is here serveurperso.com/robot/robot.bas
Pascal