Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
; WORKING ON 4MHZ CRYSTAL
.include "m32def.inc"
.cseg
; ////Definitions////;
.DEF TMP = R16 ;
.DEF LMF = R17 ;
.DEF RMF = R18 ;
.DEF SW = R19 ;
.DEF LF = R20 ;
.DEF LS = R21 ;
.DEF R_PWM = R22
.DEF L_PWM = R23
.ORG $000
RJMP START
;;;;;;;;;;;;;;;;;;;;;;
.ORG $014
RJMP TIM0_COMP ; Timer0 Compare Handler INTERRUPT VECTOR
START:
;; ////INIT////:;;
CLI ; CLEAR ALL INTERRUPTS
LDI TMP ,HIGH(RAMEND)
OUT SPH, TMP ; STACK POINTER HIGH
LDI TMP ,LOW(RAMEND)
OUT SPL ,TMP ; STACK POINTER lOW
LDI TMP , 0B00000000
OUT DDRB,TMP
OUT DDRA ,TMP
LDI TMP ,0XFF
OUT DDRC ,TMP ; PORTC AS I/P
OUT DDRD, TMP ; PORTD AS O/P
;;///////// CLEAR ALL REGISTERS///////////////////////;
CLR TMP
CLR SW
CLR R30
CLR R31
;//////////////////////////////////////////////////////;
;/// TIMERS FOR PWM HARDWARE I USED TIMER 1 16 BIT///;
;//////////////////////////////////////////////////////;
LDI TMP , 0B11110001
OUT TCCR1A , TMP ;
LDI TMP , 0B00001001 ;
OUT TCCR1B,TMP
SEI
MAIN:
RCALL SWITCHES
RJMP MAIN
SWITCHES:
SWT:
IN SW,PINB
CPI SW,0B00000111
BREQ SWT
CPI SW,0B00000110
BREQ ST1
CPI SW,0B00000101
BREQ ST2
CPI SW,0B00000011
BREQ ST3
RET
ST1:
LDI TMP , 0
OUT OCR1AH , TMP
LDI R_PWM ,0X5a
OUT OCR1AL , R_PWM
LDI TMP , 0
OUT OCR1BH , TMP
LDI L_PWM ,0X5a
OUT OCR1BL , L_PWM
RET
ST2: ;
LDI TMP,0B00000000
OUT PORTD,TMP
RET
ST3:
LDI TMP,0B11111111
OUT PORTD,TMP
RET
kemo0o said:Waiting...................
Please see your schematic, I didn't find the crystal and associated pF capacitors/ Also I think you have to arrange for auto reset circuit element so that when the power is ON the circuit is reset after a while?kemo0o said:Waiting...................