RSS

i hate myself ! i want to die!

14 Jan


mainCodeSeg segment CODE
rseg
mainCodeSeg ; Switch to this code segment.
using 0 ; Specify register bank for the following
; program code.

main: acall init ; Initialization of all used SFR’s
mov SFRPAGE, #TMR3_PAGE ; Use SFRs on the Timer3 Page
jnb TF3, $ ; Waiting for a Timer3 overflow.
clr TF3 ; Reset the overflow flag.
jmp $

Timer3Irr:
push SFRPAGE ; Save the context (SFRPAGE and ACC)
push ACC

mov SFRPAGE, #ADC2_PAGE ; Use SFRs on the ADC2 Page
clr AD2INT ; Reset AD2INT.
mov A, ADC2 ; Write the converted value in the accumulator

mov SFRPAGE, #DAC0_PAGE ; Use SFRs on the DAC0 Page
mov DAC0H, A ; Write the value from the accumulator
;in upper byte of DAC0
exit: pop ACC
pop SFRPAGE
reti
;—————————————————————————–
; FUNCTION CODE
;—————————————————————————–

init:
clr EA ; Disable global interrupts
mov WDTCN, #0DEh ; Disable Watch Dog Timer
mov WDTCN, #0ADh
initIOandCross: mov SFRPAGE, #CONFIG_PAGE ; Use SFRs on the configuration Page

mov XBR2, #0x40 ; Enable Crossbar
mov P1MDIN, #0xFE ; Configure P1.0 as analog input
mov P1MDOUT, #0x00 ; For analog data the port must be set as open-drain.

initVREF: mov SFRPAGE, #0x00 ; Use SFRs on the 0x00 Page
mov REF0CN, #0x03 ; ADC2 voltage reference from internal VREF
; Enable Bias Generator

initDAC0: mov DAC0CN, #0x84 ; Enable DAC0; a conversion will start only after

Advertisements
 
9 Comments

Posted by on January 14, 2010 in 1

 

Tags: , ,

9 responses to “i hate myself ! i want to die!

  1. beheader69

    January 14, 2010 at 15:44

     
  2. cole

    January 14, 2010 at 20:17

    microcontrolere 😐 trist, foarte trist… si eu am maine colocviu… si nu stiu nimic… 😦

     
    • 2steleparalele

      January 14, 2010 at 20:24

      io am avut azi :d l-am aburit p mister cucu pana am scos 20 de puncte de la el ;))

       
  3. colaholicu

    January 14, 2010 at 21:38

    uuuu, nasol. succes. am auzit că e “misto” materia 😀

     
    • 2steleparalele

      January 14, 2010 at 21:43

      e mistooooo materia…. mda… azi cik trebuia sa fac un program care faca sa licare un led de p o placa de test ,in functie de intensitatea luminii care cadea pe o celula solara, dak lumina era puternica sa aiba frecventa mare, slaba medie si la intuneric sa aiba frecv foarte mica… hmm.. in 40 de min sa ruleze programul…. right

       
  4. colaholicu

    January 14, 2010 at 21:50

    amuzanti profesorii pe la poli..

     
  5. fata

    January 17, 2010 at 00:21

    fataaaaa tu ai idee cate lucruri poti face in 40 de minute?
    ai putea sa deschizi un topic “ce lucruri se pot face in 40 de minute” (si mai ales, de cate ori :P)

     
  6. fata

    January 17, 2010 at 00:24

    si fata, pana la urma ce e asa greu? microcontrolerele se programeaza in c/c++, din cate cunosc eu! e un fleac 😛 la valoarea ta :))

     
    • 2steleparalele

      January 17, 2010 at 11:59

      fataaaaa… C++ a fost in anu l, in anu 2 a fost poo , iar acum e assembler 😛

       

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: