kwikstik SLD question

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

kwikstik SLD question

567 Views
derill03
Contributor I

Ok I can get the segments to light using the debugger and forcing the values into the correct registers. But I can not get my assembly code to write the values to the registers? I know im writing them correctly and to the correct address but I don't get why they wont write into the registers, any ideas?

 

Also one line after the write instruction it sends me into an interrupt, and when I step back out of the interrupt it goes to next instruction but the registers are unchanged. I would do this in C but were using this MCU in school and we are forced to use assembly

0 Kudos
4 Replies

475 Views
mjbcswitzerland
Specialist V

Hi

 

It sounds as though the SLCD module has not been enabled - there will always be an access error (and subsequent irq) when one tries to read/write a disabled module.

 

SIM_SCGC3 | SIM_SCGC3_SLCD; must be done first to enable it

 

That is set bit

 

0100 0000 0000 0000 0000 0000 0000 0000 at the address 0x40048030

 

>>using this MCU in school and we are forced to use assembly

 

Do they also force you to wear polyester suits with exaggerated lapels and flaired trousers which were also the rage in the 1970s :smileywink:

 

Regards

 

Mark

 

 

 

 

 

0 Kudos

475 Views
derill03
Contributor I
Not quite lol

Ill try making sure its enabled first thanks for reply
0 Kudos

475 Views
derill03
Contributor I

Here is my code and its making good progress cause all i need is to be able to write to the MCG_C1 register, but it wont accept the value meaning it executes instruction but doesnt change the value it stays at 0x4 instead of updating to 0x6. If i can write the MCG_C1 im good, cause i can manually change it after my code goes through and it pops the LCD right on

 

Any suggestions?

 

.section .sdata
         .align 2
VAL1:         .word 0x6
VAL2:         .word 0x40000000
VAL3:         .word 0x88b500c7

      .text
      .align 4

SIM_SCG3:      .word 0x40048030
MCG_IRCLKEN:   .word 0x40064000
LCD_GCR:       .word 0x400be000
          .global main
main:
      LDR R1,SIM_SCG3     //
      LDR R2,VAL2
      STR R2,[R1]
      LDR R1,LCD_GCR   //
      LDR R2,VAL3
      STR R2,[R1]
      LDR R1,MCG_IRCLKEN  //
      LDR R2,VAL1
      STR R2,[R1]    
      NOP
      .END


0 Kudos

475 Views
mjbcswitzerland
Specialist V

Hi

 

The registers in the MCG block are byte wide.

 

Try writing the value 0x06 using a byte write rather than a long word write.

 

Some 8 bit wide peripherals don't like being written as long words and will possibly ignore the attempt.. Also, when they don't mind it, you will be setting the value of the first 4 registers in one go and not just MCG_C1 (that is you will be writing 0x00 to MCG_C1, 0x00 to MCG_C2, 0x00 to MCG_C3 and 0x06 to MCG_C4). No idea what that would do but probably not what is expected....

 

Regards

 

Mark

 

 

0 Kudos