搜索

[8/16位单片机] 第一期评估板汇编驱动LED

[复制链接]
1334|37
 楼主 | 2020-3-27 17:26 | 显示全部楼层 |阅读模式
本帖最后由 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
效果图:
2.jpg 3.jpg
1.jpg

使用特权

评论回复
 楼主 | 2020-3-27 17:49 | 显示全部楼层

使用特权

评论回复
| 2020-3-29 16:10 | 显示全部楼层
感谢楼主分享!不过已经基本上看不懂汇编了

使用特权

评论回复
| 2020-3-29 19:39 | 显示全部楼层
感谢分享,奖励您100家园币~

使用特权

评论回复
 楼主 | 2020-3-29 22:18 | 显示全部楼层
21ic小喇叭 发表于 2020-3-29 19:39
感谢分享,奖励您100家园币~

谢谢

使用特权

评论回复
| 2020-3-31 10:27 | 显示全部楼层
现在用汇编的人不多了,赞一个

使用特权

评论回复
| 2020-4-2 16:20 | 显示全部楼层
非常感谢楼主分享

使用特权

评论回复
| 2020-4-2 16:21 | 显示全部楼层
非常感谢楼主分享

使用特权

评论回复
| 2020-4-2 16:21 | 显示全部楼层
非常感谢楼主分享

使用特权

评论回复
| 2020-4-5 21:14 | 显示全部楼层
        

使用特权

评论回复
| 2020-4-5 21:14 | 显示全部楼层
给力。         

使用特权

评论回复
| 2020-4-5 21:15 | 显示全部楼层
不能使用C语言吗  

使用特权

评论回复
| 2020-4-5 21:15 | 显示全部楼层
            

使用特权

评论回复
| 2020-4-5 21:15 | 显示全部楼层
这个板子是申请的吗

使用特权

评论回复
| 2020-4-5 21:16 | 显示全部楼层
PIC18F44J11   

使用特权

评论回复
| 2020-4-5 21:16 | 显示全部楼层
配套的原理图有吗   

使用特权

评论回复
| 2020-4-5 21:16 | 显示全部楼层
  不错。           

使用特权

评论回复
| 2020-4-5 21:16 | 显示全部楼层
有机会申请试试看。   

使用特权

评论回复
| 2020-4-5 21:17 | 显示全部楼层
楼主的试验台好多东西。   

使用特权

评论回复
| 2020-4-5 21:17 | 显示全部楼层
还有类似的板子吗      

使用特权

评论回复
扫描二维码,随时随地手机跟帖
您需要登录后才可以回帖 登录 | 注册

本版积分规则

我要发帖 投诉建议 创建版块 申请版主

快速回复

您需要登录后才可以回帖
登录 | 注册
高级模式

论坛热帖

在线客服 快速回复 返回顶部 返回列表