STM8S
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-10-22 3:14 AM
Posted on October 22, 2012 at 12:14
hello,
please is there a sort of stm8s assembly language available who convert a 16 bit binary to 5 bcd code many thanks marc debruyne
This discussion is locked. Please start a new topic to ask your question.
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-10-22 5:24 AM
Posted on October 22, 2012 at 14:24
Marc,
here is the code I use to compute the ASCII representation of an unsigned 16 bit quantity: .PrintU16 PUSHW X LDW Y,#10000 DIVW X,Y LD A,XL ADD A,#'0' LDW X,Y LDW Y,#1000 DIVW X,Y SWAPW X LDW (1,SP),X LDW X,Y LDW Y,#100 DIVW X,Y ADDW X,(1,SP) ADDW X,#'00' LDW (1,SP),X LDW X,Y LDW Y,#10 DIVW X,Y PUSH A LD A,XL LD YH,A POP A ADDW Y,#'00' POPW X RET The caller must store in the X register the quantity to convert, while on exit the registers {A,X,Y} contain its ASCII representation. I hope you'll find it useful. Regards EtaPhiOptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-10-22 5:42 AM
Posted on October 22, 2012 at 14:42 No asm, but I have a double dabble C implementation here
https://sites.google.com/site/klaasdc/stm8s-projects/16bit-to-bcd-conversion
It can probably be done better, but it's what I needed at the time. Maybe it's useful for you.Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-10-22 12:19 PM
Posted on October 22, 2012 at 21:19
hello sir,
many thanks, i have just try the program and its working very well; i must you wish ,youre a clever man. i could not find it, have search a lot, and tryed to convert from different processors, but with no result.so i have tryed the last chance to come to this forum. congratulations