Hi there
My name is Morgan Leijström
I will probably both need help as I am new to picaxe, and probably i can also give help as i was programming PICs in assembly fifteen years ago, have been designing and servicing automation hardware for 30 years, and currently program PLCs and design circuit boards.
My interest for picaxe is mainly for my son to learn programming, and build lego robots etc. Maybe also in my profession for simple projects: having the idea that the code may be readable by my customers, especially the flowcharts, which may save time on documentation. Maybe also for "home automation", several units on a RS485 network. Will see...
First exercise: hserin and 4-bit LCD mode
To get warmed up i decided to improve the AXE133 serial-to-LCD/OLED interface;
Reason: For host to be running better, it should transmit much faster, and never need to add delays, and i plan to add support for nordic characters, larger displays, animation, graphic gauges, and panel keys, knob, and status readback.
For a start I have converted it to 4-bit interface to free up 4 pins (for hserin, second enable for 4x40 displays, and i also need them to interface with panel keys and incremental knob together with the other 3 free pins and programming pins.)
It use hserin now by reading the receive flag.
Next step is to make a software buffer. (I know the X2 handle buffers in scratchpad themselves and have other useful improvements, but I try to stay with the 18M2 as in original kit so other can convert easily if anyone should like)
Two lessons so far
§ some LCD need both command 1 and 2 to really clear plus home the pointer.
§ serin/serout have some problem with speed accuracy, as i now see some other members have pointed out on this forum... it really should be in the manual, or even better get fixed...!
(Sender: 28X2, reciever 18M2; OK when using serout, serin - when changed to serout, hserin often the msbits was wrong, but adding Xtal to 28X2 fixed it. My guess is that serin speed is off a little bit, and it works or not depending on how exact the internal oscillators are in sender and receiver; if unlucky sender is off in one direction, and receiver in the other.)(I presume hser* is more exact than ser*)
Now i have some questions
__To improve reliability
§ Anyone know some trick to know if the display have got out of sync from high/low nibble in 4-bit mode?
§ some idea how to best implement checksummed serial comm?
§ Can the PIC watchdog be utilised or is it occupied by PICAXE?
__To decrease slowness
§ I read here that goto/gosub takes a nasty amount of cycles.
Do also the jump to for/do in for-next and do-loop take many cycles?
§ Is there some table of how many cycles commands take?
§ Ideas of what constructs are fastest? I guess a CASE is faster than a bunch of IF-ELSEIF? etc...
i guess that in some cases it is best to compute a variable x and use on x goto/gosub
/Morgan
My name is Morgan Leijström
I will probably both need help as I am new to picaxe, and probably i can also give help as i was programming PICs in assembly fifteen years ago, have been designing and servicing automation hardware for 30 years, and currently program PLCs and design circuit boards.
My interest for picaxe is mainly for my son to learn programming, and build lego robots etc. Maybe also in my profession for simple projects: having the idea that the code may be readable by my customers, especially the flowcharts, which may save time on documentation. Maybe also for "home automation", several units on a RS485 network. Will see...
First exercise: hserin and 4-bit LCD mode
To get warmed up i decided to improve the AXE133 serial-to-LCD/OLED interface;
Reason: For host to be running better, it should transmit much faster, and never need to add delays, and i plan to add support for nordic characters, larger displays, animation, graphic gauges, and panel keys, knob, and status readback.
For a start I have converted it to 4-bit interface to free up 4 pins (for hserin, second enable for 4x40 displays, and i also need them to interface with panel keys and incremental knob together with the other 3 free pins and programming pins.)
It use hserin now by reading the receive flag.
Next step is to make a software buffer. (I know the X2 handle buffers in scratchpad themselves and have other useful improvements, but I try to stay with the 18M2 as in original kit so other can convert easily if anyone should like)
Two lessons so far
§ some LCD need both command 1 and 2 to really clear plus home the pointer.
§ serin/serout have some problem with speed accuracy, as i now see some other members have pointed out on this forum... it really should be in the manual, or even better get fixed...!
(Sender: 28X2, reciever 18M2; OK when using serout, serin - when changed to serout, hserin often the msbits was wrong, but adding Xtal to 28X2 fixed it. My guess is that serin speed is off a little bit, and it works or not depending on how exact the internal oscillators are in sender and receiver; if unlucky sender is off in one direction, and receiver in the other.)(I presume hser* is more exact than ser*)
Now i have some questions
__To improve reliability
§ Anyone know some trick to know if the display have got out of sync from high/low nibble in 4-bit mode?
§ some idea how to best implement checksummed serial comm?
§ Can the PIC watchdog be utilised or is it occupied by PICAXE?
__To decrease slowness
§ I read here that goto/gosub takes a nasty amount of cycles.
Do also the jump to for/do in for-next and do-loop take many cycles?
§ Is there some table of how many cycles commands take?
§ Ideas of what constructs are fastest? I guess a CASE is faster than a bunch of IF-ELSEIF? etc...
i guess that in some cases it is best to compute a variable x and use on x goto/gosub
/Morgan