PDA

View Full Version : ultrasonic SF4 and PULSIN command



eitan
11-01-2012, 10:43
hello
1)is there any way modify the ULTRA command to support 2 pins one for trig and one for echo without dealing with the BASIC?
2) how do I print a 16bit variable like W6 on the LCD? I tried :LCD with [W6] , but it does not work.
3) can the command PULSIN use 16 bit var to have the result? the grafics gives only A,B,C etc which are 8 it only.

Thanks
Eitan

hippy
11-01-2012, 10:57
Logicator is designed to be simple to use using 8-bit, byte variables. For more advanced programming most things, and all that you want to do, can be achieved using BASIC flowchart cells but the standard flowchart cells are limited by design in what they support.

eitan
11-01-2012, 11:13
can you answer the PULSIN and W6 questions?

nick12ab
11-01-2012, 11:30
With the word variable on the serial LCD, you can use the serial out cell instead of the LCD cell and use '254,x,#w6' without apostrophes to convert the number into ASCII and show it on the LCD where x is the position (128 + horizontal location for line 1 or 192 + horizontal location for line 2).

ADDED: Don't forget to uncheck the ASCII checkbox. For example, this below prints the contents of w6 starting at line 1 char 1.

https://lh4.googleusercontent.com/-QyEwS7APNgI/Tw120yjf_mI/AAAAAAAAARw/lnFN2vevjtA/s340/serout.PNG

This is slightly different from the usual [A] in the LCD command because [A] uses bintoascii which results in leading zeroes and # does not result in leading zeroes. If you want leading zeroes, use a bintoascii command in a BASIC cell, put the output characters into the unused byte variables (b14 etc) and use the serout command.

hippy
11-01-2012, 11:54
can you answer the PULSIN and W6 questions?

You will have to use a BASIC cell with the following command ...

PULSIN pin, targetstate, w6

Where pin is the pin you are reading the pulse in from and targetstate the active level of the pulse you are reading, 0 or 1.

eitan
11-01-2012, 13:26
Great
Thanks
(-: