打印
[PIC®/AVR®/dsPIC®产品]

第一期评估板汇编驱动LED

[复制链接]
2940|37
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
本帖最后由 Cjy_JDxy 于 2020-3-27 17:33 编辑

今天捣鼓了一下汇编驱动LED。
代码:
#include "p18f47q10.inc"
; CONFIG1L
  CONFIG  FEXTOSC = XT          ; External Oscillator mode Selection bits (XT (crystal oscillator) above 100 kHz, below 8 MHz; PFM set to medium power)
  CONFIG  RSTOSC = EXTOSC       ; Power-up default value for COSC bits (EXTOSC operating per FEXTOSC bits (device manufacturing default))
; CONFIG1H
  CONFIG  CLKOUTEN = OFF        ; Clock Out Enable bit (CLKOUT function is disabled)
  CONFIG  CSWEN = ON            ; Clock Switch Enable bit (Writing to NOSC and NDIV is allowed)
  CONFIG  FCMEN = ON            ; Fail-Safe Clock Monitor Enable bit (Fail-Safe Clock Monitor enabled)
; CONFIG2L
  CONFIG  MCLRE = EXTMCLR       ; Master Clear Enable bit (MCLR pin (RE3) is MCLR)
  CONFIG  PWRTE = OFF           ; Power-up Timer Enable bit (Power up timer disabled)
  CONFIG  LPBOREN = OFF         ; Low-power BOR enable bit (Low power BOR is disabled)
  CONFIG  BOREN = SBORDIS       ; Brown-out Reset Enable bits (Brown-out Reset enabled , SBOREN bit is ignored)
; CONFIG2H
  CONFIG  BORV = VBOR_190       ; Brown Out Reset Voltage selection bits (Brown-out Reset Voltage (VBOR) set to 1.90V)
  CONFIG  ZCD = OFF             ; ZCD Disable bit (ZCD disabled. ZCD can be enabled by setting the ZCDSEN bit of ZCDCON)
  CONFIG  PPS1WAY = ON          ; PPSLOCK bit One-Way Set Enable bit (PPSLOCK bit can be cleared and set only once; PPS registers remain locked after one clear/set cycle)
  CONFIG  STVREN = ON           ; Stack Full/Underflow Reset Enable bit (Stack full/underflow will cause Reset)
  CONFIG  XINST = OFF           ; Extended Instruction Set Enable bit (Extended Instruction Set and Indexed Addressing Mode disabled)
; CONFIG3L
  CONFIG  WDTCPS = WDTCPS_31    ; WDT Period Select bits (Divider ratio 1:65536; software control of WDTPS)
  CONFIG  WDTE = OFF            ; WDT operating mode (WDT Disabled)
; CONFIG3H
  CONFIG  WDTCWS = WDTCWS_7     ; WDT Window Select bits (window always open (100%); software control; keyed access not required)
  CONFIG  WDTCCS = SC           ; WDT input clock selector (Software Control)
; CONFIG4L
  CONFIG  WRT0 = OFF            ; Write Protection Block 0 (Block 0 (000800-003FFFh) not write-protected)
  CONFIG  WRT1 = OFF            ; Write Protection Block 1 (Block 1 (004000-007FFFh) not write-protected)
  CONFIG  WRT2 = OFF            ; Write Protection Block 2 (Block 2 (008000-00BFFFh) not write-protected)
  CONFIG  WRT3 = OFF            ; Write Protection Block 3 (Block 3 (00C000-00FFFFh) not write-protected)
  CONFIG  WRT4 = OFF            ; Write Protection Block 4 (Block 4 (010000-013FFFh) not write-protected)
  CONFIG  WRT5 = OFF            ; Write Protection Block 5 (Block 5 (014000-017FFFh) not write-protected)
  CONFIG  WRT6 = OFF            ; Write Protection Block 6 (Block 6 (018000-01BFFFh) not write-protected)
  CONFIG  WRT7 = OFF            ; Write Protection Block 7 (Block 7 (01C000-01FFFFh) not write-protected)
; CONFIG4H
  CONFIG  WRTC = OFF            ; Configuration Register Write Protection bit (Configuration registers (300000-30000Bh) not write-protected)
  CONFIG  WRTB = OFF            ; Boot Block Write Protection bit (Boot Block (000000-0007FFh) not write-protected)
  CONFIG  WRTD = OFF            ; Data EEPROM Write Protection bit (Data EEPROM not write-protected)
  CONFIG  SCANE = ON            ; Scanner Enable bit (Scanner module is available for use, SCANMD bit can control the module)
  CONFIG  LVP = ON              ; Low Voltage Programming Enable bit (Low voltage programming enabled. MCLR/VPP pin function is MCLR. MCLRE configuration bit is ignored)
; CONFIG5L
  CONFIG  CP = OFF              ; UserNVM Program Memory Code Protection bit (UserNVM code protection disabled)
  CONFIG  CPD = OFF             ; DataNVM Memory Code Protection bit (DataNVM code protection disabled)
; CONFIG5H
; CONFIG6L
  CONFIG  EBTR0 = OFF           ; Table Read Protection Block 0 (Block 0 (000800-003FFFh) not protected from table reads executed in other blocks)
  CONFIG  EBTR1 = OFF           ; Table Read Protection Block 1 (Block 1 (004000-007FFFh) not protected from table reads executed in other blocks)
  CONFIG  EBTR2 = OFF           ; Table Read Protection Block 2 (Block 2 (008000-00BFFFh) not protected from table reads executed in other blocks)
  CONFIG  EBTR3 = OFF           ; Table Read Protection Block 3 (Block 3 (00C000-00FFFFh) not protected from table reads executed in other blocks)
  CONFIG  EBTR4 = OFF           ; Table Read Protection Block 4 (Block 4 (010000-013FFFh) not protected from table reads executed in other blocks)
  CONFIG  EBTR5 = OFF           ; Table Read Protection Block 5 (Block 5 (014000-017FFFh) not protected from table reads executed in other blocks)
  CONFIG  EBTR6 = OFF           ; Table Read Protection Block 6 (Block 6 (018000-01BFFFh) not protected from table reads executed in other blocks)
  CONFIG  EBTR7 = OFF           ; Table Read Protection Block 7 (Block 7 (01C000-01FFFFh) not protected from table reads executed in other blocks)
; CONFIG6H
  CONFIG  EBTRB = OFF           ; Boot Block Table Read Protection bit (Boot Block (000000-0007FFh) not protected from table reads executed in other blocks)


N1   EQU  20H
N2   EQU  21H

    org  0000h
    goto START
    org 0030
   
START
    nop
    BANKSEL TRISE
    MOVLW 0
    MOVWF TRISE
MAIN
    BANKSEL PORTE
    MOVLW 0
    MOVWF PORTE
    CALL DELAY
    MOVLW 1
    MOVWF PORTE
    CALL DELAY
    GOTO MAIN
DELAY
    BANKSEL N1
    MOVLW 0xF0
    MOVWF N1
DELAY1
    MOVLW 0xF0
    MOVWF N2
DELAY2
    DECFSZ N2,1
    GOTO DELAY2
    DECFSZ N1,1
    GOTO DELAY1
    RETURN
   
    end
效果图:

1.jpg (190.67 KB )

1.jpg

使用特权

评论回复
沙发
Cjy_JDxy|  楼主 | 2020-3-27 17:49 | 只看该作者

使用特权

评论回复
板凳
standar| | 2020-3-29 16:10 | 只看该作者
感谢楼主分享!不过已经基本上看不懂汇编了

使用特权

评论回复
地板
21ic小喇叭| | 2020-3-29 19:39 | 只看该作者
感谢分享,奖励您100家园币~

使用特权

评论回复
5
Cjy_JDxy|  楼主 | 2020-3-29 22:18 | 只看该作者
21ic小喇叭 发表于 2020-3-29 19:39
感谢分享,奖励您100家园币~

谢谢

使用特权

评论回复
6
251566208| | 2020-3-31 10:27 | 只看该作者
现在用汇编的人不多了,赞一个

使用特权

评论回复
7
xiaoqizi| | 2020-4-2 16:20 | 只看该作者
非常感谢楼主分享

使用特权

评论回复
8
keaibukelian| | 2020-4-2 16:21 | 只看该作者
非常感谢楼主分享

使用特权

评论回复
9
labasi| | 2020-4-2 16:21 | 只看该作者
非常感谢楼主分享

使用特权

评论回复
10
10299823| | 2020-4-5 21:14 | 只看该作者
        

使用特权

评论回复
11
lihuami| | 2020-4-5 21:14 | 只看该作者
给力。         

使用特权

评论回复
12
xiaoyaozt| | 2020-4-5 21:15 | 只看该作者
不能使用C语言吗  

使用特权

评论回复
13
uptown| | 2020-4-5 21:15 | 只看该作者
            

使用特权

评论回复
14
cehuafan| | 2020-4-5 21:15 | 只看该作者
这个板子是申请的吗

使用特权

评论回复
15
usysm| | 2020-4-5 21:16 | 只看该作者
PIC18F44J11   

使用特权

评论回复
16
jkl21| | 2020-4-5 21:16 | 只看该作者
配套的原理图有吗   

使用特权

评论回复
17
wwppd| | 2020-4-5 21:16 | 只看该作者
  不错。           

使用特权

评论回复
18
maqianqu| | 2020-4-5 21:16 | 只看该作者
有机会申请试试看。   

使用特权

评论回复
19
dspmana| | 2020-4-5 21:17 | 只看该作者
楼主的试验台好多东西。   

使用特权

评论回复
20
cehuafan| | 2020-4-5 21:17 | 只看该作者
还有类似的板子吗      

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:绿水本无忧因风皱面,青山原不老为雪白头。

553

主题

3530

帖子

19

粉丝