Assembler: please kick me in the right direction


Closed Thread
Results 1 to 27 of 27

Hybrid View

  1. #1
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,159


    Did you find this post helpful? Yes | No

    Default

    Luciano, I did. The stamp link uses the serial interface; I'd much prefer to use the parallel interface. Unless I am mistaken, that should have faster response time. The Circuit cellar example uses C, nice stuff, but nothing I can use without learning a lot of stuff. Plus, the code I have is for a 51553 demo board, exactly like the one I have on hand.

    Switching to a character LCD is not an option. That would mean basing my design on an obsolete part, not interested. Figuring out how to add a touch screen would complicate matters even more. Right now I have a solid source of gLCDs with mounted TS at an excellent price.

    I'm not exactly starting assembler from scratch either. I was top of my class, only problem is that I graduated in '83. I have references for both 8051 and PM assembler, most of the commands are easy to convert. I'll just have a few questions on the exception cases.

    That being said, would you happen to have an idea on how to convert the absolute call?
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  2. #2
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Hi,

    See this demo board:
    http://www.tvielectronics.com/Produc...ontroller.html

    The TC51553 Demo board has an option to store the data in a serial eeprom.

    When this option is used, the on-board ATmega16 (9.216 MHz) reads the data
    from a serial eeprom and sends it to the Optrex F-51553 LCD using a
    8-bit parallel interface.

    The Data Transfer of the Optrex F-51553 LCD is selectable serial
    or 8-bit parallel. If your data is stored in a serial eeprom the
    use of the parallel interface is not going to make a big speed difference.

    * * *

    Write a library for a Graphic LCD is a complex and challenging task.
    Doing that in assembly is going to be difficult and time-consuming.

    The assembly code you have posted is just a simple demo.

    Some of the functions of a Graphic LCD library are:

    - Clear display
    - Set/Reset single pixels
    - Draw lines
    - Draw boxes
    - Draw circles
    - Write text with different styles and sizes
    - Show a picture
    - ....

    Example:

    CIRCLE x,y,r,c

    x = Starting horizontal location
    y = Starting vertical location
    r = Radius of the circle
    c = Color of the circle

    * * *

    I wish you a Merry Christmas and a great success with your assembly project.

    Best regards,

    Luciano
    Last edited by Luciano; - 24th December 2005 at 13:53.

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    would you happen to have an idea on how to convert the absolute call?
    The easiest way is probably to use the L?CALL macro. That way, no matter where the destination is, the correct page bits will be set.
    L?CALL destination
    .
    DT

  4. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,159


    Did you find this post helpful? Yes | No

    Default

    Luciano, I have that document. That is the one I am using to manage the 4-wire touch screen circuit.

    I am using the schematic for the Optrex demo board from Apollo Display as a base for the LCD circuit. The charge pump circuitry is probably identical, I didn't bother comparing. Since I got the gLCDs from Apollo, I'm going to use their schematic, I also find it a bit easier to read.

    I have no doubt that writing a library for a gLCD is complex, but I'm not doing that, I'm just modifying a working example. If I was able to progam software for banks, credit cards and utility companies for 20 years, it's not unrealistic to believe that I can convert an assembler program. As it is, I understand 90% of what is happening within this code.

    As for the complexity of using all the functions of a graphic LCD, I never said I was going to use them.


    Thanks for answering my question Darrel, much appreciated!
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  5. #5
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,159


    Did you find this post helpful? Yes | No

    Default

    I've Googled, but I can't find a place with nice PM assembler code. I'm particularly interested in how the I/O pins are addressed.

    How to move a byte to a port:
    mov P1,a ;set output data

    How to reset a particular pin:
    clr P3.2 ;CS = 0

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  6. #6
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,159


    Did you find this post helpful? Yes | No

    Default

    I finally found a nice example here:
    http://picbasic.com/resources/articles/brainart.htm


    setb rp0 ;change to register page 1
    mov trisb,#00001111b ;make the bottom 4 bits on PortB inputs and the top 4 outputs
    clrb rp0 ;change back to register page 0
    ;
    clrb portb.4 ;start with output low and LED off
    ;
    loop jnb portb.0,loop ;jump to loop if switch on PortB.0 is low
    jnb portb.1,loop ;jump to loop if switch on PortB.1 is low
    ;
    ; if we got here then both switches are high
    ;
    setb portb.4 ;set output high to turn on LED


    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  7. #7
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,159


    Did you find this post helpful? Yes | No

    Default

    Ok, I've researched each instruction and these 5 have no direct translations:

    PUSH, push direct byte onto stack
    POP, pop direct byte from stack
    MUL, multiply
    ADDC, add into accumulator
    MOVC, move code byte to accumulator

    I wouldn't be surprised if the equivalent PIC Macro instructions are staring me in the face, but I don't want to start guessing. Here is some code to show the context the commands are used in:

    ; write an ASCII character to the display
    ; The font file starts at ascii 32 (blank). The default font is 8x8 pixels
    ; INPUTS - character in register A
    write_char:
    push dph
    push dpl
    clr c
    subb a,#32 ;ascii font with blank
    mov b,#8 ;multiply by 8 (8 bytes/char)
    mul ab
    add a,#low(font) ;add to font table address
    mov dpl,a
    mov a,b
    addc a,#high(font)
    mov dph,a
    mov r0,#8 ;8 bytes/char
    wbyte: clr a
    movc a,@a+dptr
    acall write_data
    inc dptr
    djnz r0,wbyte
    pop dpl
    pop dph
    ret

    8051 assembler reference here:
    http://www.ece.umr.edu/computing/uni...e/tasking/asm/

    PIC Macro assembler reference:

    Robert
    Attached Files Attached Files
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  8. #8
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Robert,

    The PUSH and POP were apparently used to save 2 variables that were used in the write_char: routine. You can just use separate variables to temporarily store the two bytes, instead of trying to use the stack.

    MUL can be replaced with the MUL?BBB or MUL?BBW macro.

    For the addc and movc, you can either manipulate the EEADDR, EECON and EEDATA registers manually, or you could break out of ASM and use the READCODE statement to get the byte first, then do the ADDWF or MOVWF.

    HTH,
    Darrel
    Last edited by Darrel Taylor; - 24th December 2005 at 19:36.

Similar Threads

  1. decoding quadrature encoders
    By ice in forum mel PIC BASIC Pro
    Replies: 93
    Last Post: - 28th February 2017, 09:02
  2. PIC assembler forum?
    By Lajko in forum Off Topic
    Replies: 1
    Last Post: - 29th September 2008, 05:34
  3. Assembler problem
    By om3bc in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 25th March 2008, 19:12
  4. Am I reading this assembler correctly?
    By crhomberg in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 13th November 2007, 12:20
  5. Which assembler are you using?
    By picnaut in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 1st November 2005, 20:34

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts