KWIKSTIK SLCD HELP TO JUST LIGHT A SEGMENT

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

KWIKSTIK SLCD HELP TO JUST LIGHT A SEGMENT

ソリューションへジャンプ
834件の閲覧回数
derill03
Contributor I

Hello I am a neewb to the ARM family, i am in a lab class where we are using assembly to write code on the kwikstik K40.

 

I am really frustrated as i nor the teacher can figure out how to light even one segment on the SLCD, can anyone help me with just a small code in ASSEMBLY please that will help me understand what steps need to be taken to light some segments PLEASE!!

 

Below is what ive tried just by poking in the debug registers and trying to get something but it crashes and does not store any values to the specified registers

 

.section .sdata
         .align 2
VAL1:         .word 0x00000001
VAL2:         .word 0x00000001
VAL3:         .word 0x00000001
VAL4:         .word 0x80800080

      .text
      .align 4

LCD_GCR:  .word 0x400BE000
LCD_PENL:   .word 0x400BE010

          .global main
main:
      LDR R1,LCD_GCR
      LDR R2,VAL4
      STR R2,[R1]
      LDR R1,LCD_PENL
      LDR R2,VAL1
      STR R2,[R1]
      NOP
      .END
0 件の賞賛
1 解決策
632件の閲覧回数
mjbcswitzerland
Specialist V

Hi

 

The segment LCD controller needs to be powered up and configured before it can be used.

 

The following initialisation is required:

 

                                   MCG_C1 |= MCG_C1_IRCLKEN; \                                   POWER_UP(3, SIM_SCGC3_SLCD); \                                   LCD_GCR = (LCD_GCR_CPSEL | LCD_GCR_RVEN | LCD_GCR_RVTRIM_MASK | LCD_GCR_LADJ_MASK | LCD_GCR_LCLK_0 | LCD_GCR_VSUPPLY_VLL3_EXT | LCD_GCR_SOURCE | LCD_GCR_DUTY_8BP | LCD_GCR_ALTDIV_NONE); \                                   LCD_PENL = 0xfffffffe; \                                   LCD_PENH = 0x0000ffff; \                                   LCD_BPENL = 0x00000000; \                                   LCD_BPENH = 0x0000ff00; \                                   fnClearSLCD(); \                                   WRITE_SLCD(43TO40, 0x08040201); \                                   WRITE_SLCD(47TO44, 0x80402010); \                                   LCD_GCR = (LCD_GCR_LCDEN | LCD_GCR_CPSEL | LCD_GCR_RVEN | LCD_GCR_RVTRIM_MASK | LCD_GCR_LADJ_MASK | LCD_GCR_LCLK_0 | LCD_GCR_VSUPPLY_VLL3_EXT | LCD_GCR_SOURCE | LCD_GCR_DUTY_8BP | LCD_GCR_ALTDIV_NONE)

 

You can convert this to assembler in a few minutes since it is just setting up registers as in your example code.

 

1) The clock must be configured (in MCG)

2) The SLCD controller must be clocked

3) The configuration include a sub-routine resetting all segment controls LCD_WF3TO0 to LCD_WF63TO60 because the controller doesn't clear these after a reset and the display after a reset otherwsie holds the same image as before the reset.

 

See also http://www.utasker.com/docs/uTasker/uTasker_SLCD.pdf and http://www.youtube.com/watch?v=nm2DmZv1rj8

 

Regards

 

Mark

 

元の投稿で解決策を見る

0 件の賞賛
3 返答(返信)
632件の閲覧回数
Andrewm
Contributor I

Try putting 2 NOPS between each assembly instruction, in case there is a pipelining issue.

-Andrew M

 

0 件の賞賛
632件の閲覧回数
derill03
Contributor I

nope does not work, im not sure if i am even doing this correctly to light the segment

0 件の賞賛
633件の閲覧回数
mjbcswitzerland
Specialist V

Hi

 

The segment LCD controller needs to be powered up and configured before it can be used.

 

The following initialisation is required:

 

                                   MCG_C1 |= MCG_C1_IRCLKEN; \                                   POWER_UP(3, SIM_SCGC3_SLCD); \                                   LCD_GCR = (LCD_GCR_CPSEL | LCD_GCR_RVEN | LCD_GCR_RVTRIM_MASK | LCD_GCR_LADJ_MASK | LCD_GCR_LCLK_0 | LCD_GCR_VSUPPLY_VLL3_EXT | LCD_GCR_SOURCE | LCD_GCR_DUTY_8BP | LCD_GCR_ALTDIV_NONE); \                                   LCD_PENL = 0xfffffffe; \                                   LCD_PENH = 0x0000ffff; \                                   LCD_BPENL = 0x00000000; \                                   LCD_BPENH = 0x0000ff00; \                                   fnClearSLCD(); \                                   WRITE_SLCD(43TO40, 0x08040201); \                                   WRITE_SLCD(47TO44, 0x80402010); \                                   LCD_GCR = (LCD_GCR_LCDEN | LCD_GCR_CPSEL | LCD_GCR_RVEN | LCD_GCR_RVTRIM_MASK | LCD_GCR_LADJ_MASK | LCD_GCR_LCLK_0 | LCD_GCR_VSUPPLY_VLL3_EXT | LCD_GCR_SOURCE | LCD_GCR_DUTY_8BP | LCD_GCR_ALTDIV_NONE)

 

You can convert this to assembler in a few minutes since it is just setting up registers as in your example code.

 

1) The clock must be configured (in MCG)

2) The SLCD controller must be clocked

3) The configuration include a sub-routine resetting all segment controls LCD_WF3TO0 to LCD_WF63TO60 because the controller doesn't clear these after a reset and the display after a reset otherwsie holds the same image as before the reset.

 

See also http://www.utasker.com/docs/uTasker/uTasker_SLCD.pdf and http://www.youtube.com/watch?v=nm2DmZv1rj8

 

Regards

 

Mark

 

0 件の賞賛