Posted 21 Jan 2004 Hello, I want to get a formula for basic so I can convert a Integer word with 2 ascii sign to split them in a MSD and LSD. Example: I have received from a database PC a Integer word N7:0 = 8525. These word have 2 ASCII words: MSD=! and LSD=M. How is the formula for basic (1771-db) so that I can split this integer word(8525) in MSD=33 (ascii=!) and LSD=77 (ascii=M)? Any ideas? Greetings, mulderm Share this post Link to post Share on other sites
Posted 21 Jan 2004 In the SLC instruction set, the AEX command (ASCII string extract) lets you split up an ascii string and move it elsewhere. It may be a bit long winded, but you could use this intruction to split up your !M into ! and M (you may have to use the instruction twice), when you have split it up it will reside in two seperate string registers, you may then use the ACI (Ascii string to integer) to convert it back to an integer. There is probably an easier way though! Share this post Link to post Share on other sites
Posted 21 Jan 2004 (edited) The magic word is modulo function. There are several ways to do it. This is probably the simplest one. If your scan time is at premium, you could try BSR instead of DIV. I am not sure if that would bring any gains as I'm trying to avoid them. I like bitshift or bit rotate functions but BSL and BSR sintax is rather frustrating... Edited 21 Jan 2004 by panic mode Share this post Link to post Share on other sites
Posted 22 Jan 2004 Thank you guys. It´s now understanding for me. mulderm Share this post Link to post Share on other sites