ראיתי את הקוד הזה לPWM:
- קוד: בחר הכל
TIMER_0_INTERRUPT:
JB F0, HIGH_DONE ; If F0 is set then we just finished the high section of the
LOW_DONE: ; cycle so Jump to HIGH_DONE
SETB F0 ; Make F0=1 to indicate start of high section
SETB P1.0 ; Turn off LED
MOV TH0, R7 ; Load high byte of timer with R7 (our pulse width control value)
CLR TF0 ; Clear the Timer 0 interrupt flag
RETI ; Return from Interrupt to where the program came from
HIGH_DONE:
CLR F0 ; Make F0=0 to indicate start of low section
CLR P1.0 ; Turn on LED
MOV A, #FFH ; Move FFH (255) to A
CLR C ; Clear C (the carry bit) so it does not affect the subtraction
SUBB A, R7 ; Subtract R7 from A. A = 255 - R7.
MOV TH0, A ; so the value loaded into TH0 + R7 = 255
CLR TF0 ; Clear the Timer 0 interrupt flag
RETI ; Return from Interrupt to where the program came from
אבל לא הבנתי שם כמה פקודות.
מה זה SETB,JB.
עכשיו אם אני ירצה ליצור דיוטי סייקל עם דילאים זה גם אפשרי לא?
אני יוצר לולאה (בלי שימוש בפסיקות הפנמיות ובמונים) ויוצר דילאים בין ה1 ל0.
ומשהו אחרון- למישהו יש סכמה של חיבור 8051 לגשר H ולמפענח?
כי יש לי שם 4 סטים של פורטים - 0 1 2 3 ואני לא יודע במה אני משתמש.
אגב איך אני קורא לכל פורט בתוכנית? יש לו כתובת מסוימת או פשוט P1.0 למשל?