Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13
  1. #11

    Default Re: Help assembly language


    ; this short program for emu8086 shows how to keep constant temperature
    ; using heater and thermometer (between 60° to 80°),
    ; it is assumed that air temperature is lower 60°.

    ; thermometer.exe is started automatically from c:\emu8086\devices.
    ; it is also accessible from the "virtual devices" menu of the emulator.

    #start=thermometer.exe#

    ; temperature rises fast, thus emulator should be set to run at the maximum speed.

    ; if closed, the thermometer window can be re-opened from emulator's "virtual devices" menu.



    #make_bin#

    #start=led_display.exe#


    #make_bin#

    #start=stepper_motor.exe#


    ;name "stepper"

    #make_bin#


    name "thermo"


    ; ========= data ===============

    ; bin data for clock-wise
    ; half-step rotation:
    datcw db 0000_0110b
    db 0000_0100b
    db 0000_0011b
    db 0000_0010b

    ; bin data for counter-clock-wise
    ; half-step rotation:
    datccw db 0000_0011b
    db 0000_0001b
    db 0000_0110b
    db 0000_0010b


    ; bin data for clock-wise
    ; full-step rotation:
    datcw_fs db 0000_0001b
    db 0000_0011b
    db 0000_0110b
    db 0000_0000b

    ; bin data for counter-clock-wise
    ; full-step rotation:
    datccw_fs db 0000_0100b
    db 0000_0110b
    db 0000_0011b
    db 0000_0000b



    ; set data segment to code segment:
    mov ax, cs
    mov ds, ax

    start:
    ;mov ax, cs
    ;mov ds, ax
    in al, 125
    mov ah, 0
    ;mov dx, ax
    out 199, ax ; output temp to LED port(199)
    ;mov ax,dx

    ;in al, 125

    cmp al, 10
    jl very_low

    cmp al, 30
    jle low

    cmp al, 50
    jle med
    jg high


    very_low:
    cmp al, 2
    jle heater_on
    ;mov al, 1
    ;out 127, al ; turn heater "on".
    jmp start


    heater_on:
    mov al, 1
    out 127, al ; turn heater "on".
    jmp start


    low:
    mov cx, 14
    jmp stepper

    med:
    mov cx, 7
    jmp stepper

    high:
    mov cx, 1
    cmp al, 80
    jg heater_off
    jmp stepper

    heater_off:
    mov al, 0
    out 127, al ; turn heater "off".
    jmp stepper



    stepper:
    mov bx, offset datcw ; start from clock-wise half-step.
    mov si, 0
    ;mov cx, 0 ; step counter

    next_step:
    ; motor sets top bit when it's ready to accept new command
    wait: in al, 7
    test al, 10000000b
    jz wait

    mov al, [bx][si]
    out 7, al



    inc si
    cmp si, 4
    jb next_step
    mov si, 0
    delay:
    dec cx
    cmp cx, 0
    jnz delay
    mov cx, 0

    ;inc cx
    ;cmp cx, steps_before_direction_change
    ;jb next_step

    ;mov cx, 0
    ;add bx, 4 ; next bin data

    ;cmp bx, offset datccw_fs
    ;jbe next_step

    ;mov bx, offset datcw ; return to clock-wise half-step.

    jmp start

  2. #12

    Default Re: Help assembly language

    nia ra..

    Code:
    #start=thermometer.exe#     
    #start=led_display.exe#     
    #start=stepper_motor.exe#                    
                                                  
    #make_bin#
    
    name "fan"
    
    jmp initialize
                          
    
    fan_data db 0000_0110b
             db 0000_0100b    
             db 0000_0011b
             db 0000_0010b
                                   
    initialize:       
        mov si, 0
        lea bx, fan_data
        
    start:                                  
        in al, 125                  
              
        out 199, al                 
                            
        cmp al, 0                   
        jle heater_on               
    
    
        cmp al, 70                  
        jge heater_off              
                                
        jmp fan                     
    
    heater_on: 
        push ax                     
        mov al, 1               
        out 127, al
        pop ax                             
    
        jmp fan                     
    
    heater_off:
        push ax                     
        mov al, 0
        out 127, al
        pop ax  
    
    fan:               
        cmp al, 10
        jle start
      
        cmp al, 50
        jge rotate
                   
        mov cx, 0
                   
        cmp al, 30
        jge medium
        
    slow:
        mov ch, 4
        jmp delay
        
    medium:
        mov ch, 2    
        
    delay:    
        mov al, 0000_0000b
        out 7, al
        
        inc cl
        
        cmp cl, ch
        jb delay         
        
    rotate:    
        mov al, [bx][si]
        out 7, al
        
        inc si
    
        cmp si, 4
        jb start
           
        mov si, 0                              
                          
        jmp start

  3. #13

    Default Re: Help assembly language

    wow assembly! hardware programming jud.. very nice topic. wala lng ko idea ani ky software ra aq focus..
    my unta mkakat-on pud ko ani puhon

  4.    Advertisement

Page 2 of 2 FirstFirst 12

Similar Threads

 
  1. help!configuring textpad for assembly language
    By cute_6423 in forum Programming
    Replies: 5
    Last Post: 09-29-2012, 06:02 PM
  2. assembly language Need help :D
    By matiasaznar in forum Programming
    Replies: 9
    Last Post: 11-03-2011, 09:39 PM
  3. help on assembly language
    By wailer in forum Programming
    Replies: 2
    Last Post: 04-30-2010, 11:30 AM
  4. Project Help with Assembly Language.
    By hakkai999 in forum Programming
    Replies: 1
    Last Post: 10-08-2009, 07:05 AM
  5. nid help for assembly language prog..
    By tanilong in forum Programming
    Replies: 1
    Last Post: 02-23-2006, 02:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top