PIC12C508 single-chip lighting control system source program

Publisher:科技创造者Latest update time:2017-12-07 Source: eefocusKeywords:PIC12C508 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

;P IC 12C508  single-chip microcomputer  lighting control system source program  

;The above program uses PIC12C508 single-chip microcomputer, internal 4M Hz clock, 50HZ pulse signal input at pin 4, and output at pins 7, 6, and 3 (GP0, GP1, and GP4 ports). The gradual change part makes the light gradually brighter (or off). I don't know if there are any errors in the single-chip microcomputer lighting control system program. If there are any errors, please give me more comments. Thank you  
;The program is as follows: 

GPI0 EQU 6 

COUNT1 EQU 11 
COUNT2 EQU 12 
COUNT3 EQU 13 
COUNT4 EQU 14 
COUNT5 EQU 15 
POINTER EQU 16 
POINTER1 EQU 17 

ORG 00H 
MOV LW 07H ;Set clock parameter 1:256 frequency division 
OPTION 
MOV LW 2CH ;Output port setting 0,1,4 output, 3 input 50HZ 
TRIS 6 

;------------------------------- 
START: 
;Scan 3 ports Scan 0 low potential 
MOV F GPI0,W 
MOV WF COUNT1 
BTFSC COUNT1,3 
GOTO START 
NEXT: ;Scan 3 ports Scan 1 high potential 
MOV F GPI0,W 
MOV WF COUNT1 
BTFSS COUNT1,3 
GOTO NEXT 

INCF COUNT2 
MOV LW 100 
DECFSZ COUNT2,1 
GOTO START ;------External 50HZ signal, scan 100 times, delay 2 seconds 

;------------------- Single chip light control system---------------------------------------- 
JB: 
CLRF TMR0 
MOV LW 250 
MOV WF COUNT4 
MOV WF COUNT5 

INCF POINTER,F 
MOV F POINTER,0 
MOV WF POINTER1 
MOV LW TABLE 
ADDWF POINTER,0 
CALL AA 
MOV WF 6 ;Return, output-----on 
CHANGE: 
MOV F TMR0,0 
MOV WF COUNT3 
SUBWF COUNT4,1 
BTFSS STATUS,Z ;TMR0=250? N empty loop TMR0 times Y jump out and restart the gradient 
GOTO NOPDELAY1 
GOTO OUT 
NOPDELAY1: 
NOP 
DECFSZ COUNT3,1 
GOTO NOPDELAY1 

DECF POINTER1,F ; <--- Single-chip light control system-------| 
MOV LW TABLE ; | 
ADDWF POINTER1,0 ; | 
CALL AA ; | 
MOV WF 6 ; Return to the last displayed data and output to the GP port--- off <--| 
NOPDELAY2: 
NOP 
DECFSZ COUNT4,1 
GOTO NOPDELAY2 
GOTO CHANGE 
;----- Gradual----- Change------------ Single-chip light control system----------------------------------- 
OUT: 
MOV LW 9 ; Take the table 9 times 
SUBWF POINTER,0 
BTFSS STATUS,Z 
GOTO JB 
GOTO START 


AA: MOV WF 2 
TABLE:RETLW 2CH 
RETLW 3CH 
RETLW 2DH 
RETLW 2EH 
RETLW 2FH 
RETLW 3DH 
RETLW 3EH 
RETLW 2CH 
RETLW 3FH 

ORG 1FFH 
MOV WF OS CC AL 
END 


Keywords:PIC12C508 Reference address:PIC12C508 single-chip lighting control system source program

Previous article:PIC microcontroller car anti-theft alarm sound (anti-theft device)
Next article:Telephone Amplifier Controlled by PIC16C54 Microcontroller

Recommended ReadingLatest update time:2024-11-16 19:53

PIC12C508 based DTMF dialing program writing and sharing
pIC12C508 DTMF Dialer ;|Name:MAIN.ASM| ;|Description:DTMF-》RS232converter(forusewithPCNummerViser)| ;|DetectsDTMFandringing,andtransmitstoastd.| ;|RS232port,at2400baud.| ;||| ;+--------------------------------------------------------------------+ ;|Platform:PIC12C508(A)(usinginternal4MHzRC-oscillator)| ;|Uses:90-342
[Microcontroller]
PIC12C508 based DTMF dialing program writing and sharing
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号