Advertisement
Guest User

Untitled

a guest
Jun 9th, 2019
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. NAME functions
  2.         #include "msp430.h"  
  3.  
  4.         PUBLIC digitLcd    
  5.         PUBLIC lcdInit      
  6.         PUBLIC adcInit      
  7.    
  8.         RSEG CODE      
  9.  
  10. digitLcd:
  11.         ;zmienna na R12
  12.         cmp     #0,     R12
  13.         jeq     comp0
  14.         cmp     #1,     R12
  15.         jeq     comp1
  16.         cmp     #2,     R12
  17.         jeq     comp2
  18.         cmp     #3,     R12
  19.         jeq     comp3
  20.         cmp     #4,     R12
  21.         jeq     comp4
  22.         cmp     #5,     R12
  23.         jeq     comp5
  24.         cmp     #6,     R12
  25.         jeq     comp6
  26.         cmp     #7,     R12
  27.         jeq     comp7
  28.         cmp     #8,     R12
  29.         jeq     comp8
  30.         cmp     #9,     R12
  31.         jeq     comp9
  32.         jmp     end_comp
  33.        
  34.         comp0:
  35.                 mov.w   #0FC28h,        R12
  36.                 ret
  37.         comp1:
  38.                 mov.w   #06020h,        R12
  39.                 ret
  40.         comp2:
  41.                 mov.w   #0DB00h,        R12
  42.                 ret
  43.         comp3:
  44.                 mov.w   #0F300h,        R12
  45.                 ret
  46.         comp4:
  47.                 mov.w   #06700h,        R12
  48.                 ret
  49.         comp5:
  50.                 mov.w   #0B700h,        R12
  51.                 ret
  52.         comp6:
  53.                 mov.w   #0BF00h,        R12
  54.                 ret
  55.         comp7:
  56.                 mov.w   #0E400h,        R12
  57.                 ret
  58.         comp8:
  59.                 mov.w   #0FF00h,        R12
  60.                 ret
  61.         comp9:
  62.                 mov.w   #0F700h,        R12
  63.                 ret
  64.         end_comp:
  65.                 ret
  66.    
  67. lcdInit:    
  68.         bic     #1,     LCDCCTL0
  69.         mov.w   #049Eh, LCDCCTL0        
  70.         mov.w   #1,     LCDCCTL1        
  71.         mov.w   #0,     LCDCBLKCTL
  72.         mov.w   #1008h, LCDCVCTL
  73.         mov.w   #0FFD0h,LCDCPCTL0
  74.         mov.w   #0F83Fh,LCDCPCTL1
  75.         mov.w   #000F8h,LCDCPCTL2
  76.         mov.w   #08000h,LCDCCPCTL
  77.         bis     #6,     LCDCMEMCTL
  78.         NOP
  79.         bis     #1,     LCDCCTL0
  80.         ret
  81.        
  82. adcInit:
  83.         mov.w   #00000h,ADC12CTL0
  84.         mov.w   #00810h,ADC12CTL0
  85.         mov.w   #00200h,ADC12CTL1
  86.         mov.w   #00080h,ADC12CTL3
  87.         mov.w   #0011Eh,ADC12MCTL0
  88.         mov.w   #0001h, ADC12IER0
  89.         ret
  90. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement