完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,我已经编写了代码来从睡眠中唤醒PIC18LF26K80,并解码UART十六进制字节7E。在模拟器中,当使用UPDM2作为调试器时,这不是成功的。7E字节是通过USB端口用FTDI电缆USB发送到UART的。我已经探查PICAND的RX PIN RB4,它确实是PIC接收的7E,但是在ICD3调试模式下,如果正确接收H’7E’字节,则UART RX例程接收HFF',然后打开UPM2的LeD0。我已经附加了5 .ASM文件,并且我在这里显示.Inc文件。检查一下我的代码,我会很感激。我忘记给.SCL文件做模拟了。它遵循
UAST ASM(2.41 KB)-下载30次WielySkyAcaLaVal.ASM(11.05 KB)-下载30次GunuSuth.ASM(3.10 KB)-下载28次VARES.ASM(1.60 KB)-下载28次 以上来自于百度翻译 以下为原文 hi. I have written code to wake up PIC18LF26K80 from sleep and decode the uart hex byte 7E. In simulator this succeds but not while using the UPM2 with ICD3 as a debugger. The 7E byte is send via the u*** port with a FTDI cable u*** to uart. I have probed the RX pin RB4 of PIC and it is indeed 7E what the PIC receives but while in ICD3 debug mode the uart rx routine receives a H'FF' If the H'7E' byte is received correctly then then LED0 of UPM2 is turned on. I have attached the 5 .asm files and I am displaying the .inc files here. If you can check my code i would be grateful. ; ###################################################################### ; Start of file "Define_IO.inc" ; ###################################################################### ;PROJECT - Wireless Camera VerA ; SECTION - PCIP PIC Code ; MODULE ; ---------------------------------------------------------------------- ; (c)2016 ; 3 Tirynthos ; Peristeri ; Athens ; 12135 ; Greece ; Tel. (+30) 211 4009773 ; ====================================================================== ; REVISION HISTORY ; ..........................----------------............................ ; Mark the next block as comment by begining with #if 0 and ending with # endif. #if 0 $History: Define_IO.inc $ ; ; ***************** Version 0 ***************** ; 26-05-16 Alexandros Stefanidis ; Version 0 is using PIC18LF26K80 ; Based on V8 Water TransPondIT #endif ; ====================================================================== ; Pin assignments ; Port A ; ------ ;RA0 - Don't care X ;RA1 /CS - Chip Select (conected to memory /CS) Output ;RA2 /HOLD - Chip Hold (conected to memory /HOLD) Output ;RA3 /WP - Chip Write Protect (conected to memory /WP) Output ;RA5 - Don't care X ;RA6 OSC2 Input? ;RA7 OSC1 Input? #define bit_FRAM_1CS 1 #define IO_FRAM_1CS PORTA,bit_FRAM_1CS #define bit_FRAM_1HOLD 2 #define IO_CY15B_1HOLD PORTA,bit_FRAM_1HOLD #define bit_FRAM_1WP 3 #define IO_FRAM_1WP PORTA,bit_FRAM_1WP ; Port B ; ------ ;RB0 Not Used X ;RB1 Not Used X ;RB2 Can Bus TX Always an Output ;RB3 CAn Bus RX Always an Input ;RB4 UART RX Always an Input ;RB5 Not Used X ;RB6 ICSP Clock Always an Input(?) ;RB7 ICSP Data Always an Input(?) #define bit_Can_Bus_TX 2 #define IO_Can_Bus_TX PORTB,bit_Can_Bus_TX #define bit_Can_Bus_RX 3 #define IO_Can_Bus_RX PORTB,bit_Can_Bus_RX #define bit_Uart_RX 4 #define IO_Uart_RX PORTB,bit_Uart_RX ; Port C ; ------ ; RC0 - Not Used ; RC1 - /CS - Chip Select Pin (conected to C329a 1CS) Output ; RC2 - HOLD - Chip Hold Pin (conected to C329a HOLD) Output ; RC3 SCK - Serial Synchronous clock (conected to FRAMs/C329a SCK) Output ; RC4 SDI - SPI data in (conected to FRAMs/C329a SO) Input ; RC5 SDO - SPI data out (conected to FRAMs/C329a SI) Output #define bit_C329a_1CS 1 #define IO_C329a_1CS PORTA,bit_C329a_1CS #define bit_C329a_HOLD 2 #define IO_C329a_HOLD PORTA,bit_C329a_HOLD #define bit_FRAM_SCK 3 #define IO_FRAM_SCK PORTC,bit_FRAM_SCK #define bit_C329a_CLK 3 #define IO_C329a_CLK PORTC,bit_C329a_CLK #define bit_FRAM_SO 4 #define IO_FRAM_SO PORTC,bit_FRAM_SO #define bit_C329a_MISO 4 #define IO_C329a_MISO PORTC,bit_C329a_MISO #define bit_FRAM_SI 5 #define IO_FRAM_SI PORTC,bit_FRAM_SI #define bit_C329a_MOSI 5 #define IO_C329a_MOSI PORTC,bit_C329a_MOSI ; ###################################################################### ; Start of file "Project.inc" ; ###################################################################### ; PROJECT - Wireless Camera VerA ; SECTION - PCIP PIC Code ; MODULE ; ---------------------------------------------------------------------- ; (c)2015 ; 3 Tirynthos ; Peristeri ; Athens ; 12135 ; Greece ; Tel. (+30) 211 4009773 ; ====================================================================== ; REVISION HISTORY ; ..........................----------------............................ ; Mark the next block as comment by begining with #if 0 and ending with # endif. #if 0 $History: Project.inc $ ; ; ***************** Version 0 ***************** ; 26-05-16 Alexandros Stefanidis ; Version 0 is using PIC18LF26K80 ; Based on V8 Water TransPondIT #endif ; ====================================================================== ; Listing Directives list P=18LF26K80, r=dec, n=0, f=inhx8m, mm=ON, st=ON ; Default number radix is decimal ; f=inhx8m sets the hex file output to inhx8m ; mm=ON prints the memory map in the list file ; st=ON prints the symbol table in the list file errorlevel 0 ; Print all messages, warnings and errors in the list file ; errorlevel -302 ; Suppress "Msg 302: Register not in bank 0. Ensure bank bits are correct." title "Wireless Camera Ver.A(18LF26K80)" subtitle "(c)Alexandros Stefanidis" ;Macro Directives expand ; Print macro expansions in the list file ; Included files #include ;#include "macros.inc" ;=============================================================================== ; Status Bits #define SR_N STATUS,N #define SR_OV STATUS,OV #define SR_Zero STATUS,Z #define SR_DC STATUS,DC #define SR_Carry STATUS,C ; ********************************************************************** ; Start of file "Vars.inc" ; ====================================================================== ; PROJECT - Wireless Camera Ver.A ; SECTION - PCIP PIC Code ; MODULE ; ---------------------------------------------------------------------- ; (c)2011 ; 3 Tirynthos ; Peristeri ; Athens ; 12135 ; Greece ; Tel. (+30) 211 4009773 ; ====================================================================== ; REVISION HISTORY ; ..........................----------------............................ ; Mark the next block as comment by begining with #if 0 and ending with # endif. #if 0 $History: Vars.inc $ ; ; ***************** Version 0 ***************** ; 02-06-15 Alexandros Stefanidis ; Version 0 is using PIC18F66K80 ; Based on V8 Water TransPondIT #endif ; ====================================================================== ; Define external access to variables defined in vars.asm EXTERN bx_Temp_L, bx_Temp_W, bx_Temp_M, bx_Temp_H ; ====================================================================== ; ********************************************************************** ; Start of file "macros.inc" ; ====================================================================== ; PROJECT - Wireless_Camera_Ver.A ; MODULE - Macro defintions ; FILE - Macros.inc ; ---------------------------------------------------------------------- ; (c)2016 Alexandros Stefanidis ; 3 Tyrinthos Str. ; Peristeri ; Athens ; Greece ; 12135 ; ; Tel. (+30) 2114009773 ; ====================================================================== ; REVISION HISTORY ; ..........................----------------............................ #if 0 ; Revision history is now provided through Visual Source Safe ; The history block is commented out so that history comments are ; ignored. $History: macros.inc $ ; ; ***************** Version 0 ***************** ; 09-June-16 Alexandros Stefanidis #endif ; ====================================================================== ; ; Input: WREG = 0 to 255 offset into table ; C_CALL MACRO Jump_Table xorlw HIGH(Jump_Table+2) ; Convolute high jump table address with low offset movwf PCLATH ; Store for a bit in the PCLATH resgiter xorlw HIGH(Jump_Table+2) ; Recover table offset xorwf PCLATH ; Fix up PCLATH value addwf WREG,W ; Jump table is in WORDS so double the offset bnc $+4 ; Skip if does not cross boundary incf PCLATH ; Adjust high byte when it does addlw LOW (Jump_Table+2) ; Add to table base address bnc $+4 ; Skip if does not cross boundary incf PCLATH ; Adjust high byte when it does call Jump_Table ENDM I forgot to give the .scl file for the simulation. It follows // // C:UsersHPMPLABXProjectsFTDI_UART_COMMS.Xuart_rx.scl // Generated by Stimulus MPLAB X // Wed Feb 15 11:44:11 EET 2017 // configuration for "pic18f26k80" is end configuration; testbench for "pic18f26k80" is begin process is // 1st process begin KBI0 <= '0'; wait for 104 us; KBI0 <= '0'; wait for 104 us; KBI0 <= '1'; wait for 104 us; KBI0 <= '1'; wait for 104 us; KBI0 <= '1'; wait for 104 us; KBI0 <= '1'; wait for 104 us; KBI0 <= '1'; wait for 104 us; KBI0 <= '1'; wait for 104 us; KBI0 <= '0'; wait for 104 us; KBI0 <= '1'; end process; end testbench; Attachment(s) IO.asm (5.78 KB) - downloaded 26 times UART.asm (2.41 KB) - downloaded 30 times wireless_camera_vera.asm (11.05 KB) - downloaded 30 times gen_subs.asm (3.10 KB) - downloaded 28 times Vars.asm (1.60 KB) - downloaded 28 times |
|
相关推荐
1个回答
|
|
我已经对我的代码做了一些修改,来处理RB0的It0:在WielySkyCasaVel.asmio.ASM中。
以上来自于百度翻译 以下为原文 I have made some changes to my code to work with the INT0 of RB0: in wireless_camera_vera.asm Loop1 NOP ; Put the device to sleep BCF OSCCON,IDLEN NOP SLEEP ;Device goes normally to sleep and it is waken by the UART byte '7E' NOP NOP ;BSF PORTA,1 ; RA1 connected to LED0 of UPM2 succeeds when wake from sleep NOP NOP NOP BTFSC PORTB,0 ;;;Here it fails!!!!! INT0 in RB0 on falling edge. It should be checking for the start bit GOTO Loop1 NOP ; Wake up from sleep due to RB4 IOC ; A high to low transition is the start bit of uart rx byte ;MOVLB 15 ;MOVLW B'00000000' ;Disable any further IOCB on pin RB4 ;MOVWF IOCB ;MOVLB 0 BSF PORTA,1 ;Never reached this point HIGH_ISR: ; Insert High Priority ISR Here ;MOVLB 15 ;MOVF PORTB,W NOP BCF INTCON,INT0IF ;MOVLB 0 retfie FAST IO.asm MOVLW B'00010001' MOVWF LATB MOVLW B'11111011' MOVWF TRISB MOVLW B'11010000' MOVWF INTCON |
|
|
|
只有小组成员才能发言,加入小组>>
5160 浏览 9 评论
1998 浏览 8 评论
1927 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3170 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2225 浏览 5 评论
727浏览 1评论
612浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
501浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
626浏览 0评论
524浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-22 08:27 , Processed in 1.285313 second(s), Total 75, Slave 58 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号