完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我加快了这个简单的代码,当用MPASM 5.20直接编译成一个十六进制文件时,它工作得很好。(LED的替代)它在一个VelLeMon 8076板。但是如果我在IDE中编译非常相同的代码,并通过我的PACKIT3加载它,它加载OK。但只是不跑…我错过了一些非常明显的事情吗?
以上来自于百度翻译 以下为原文 I whipped up this simple code, that when compiled with MPASM 5.20 direct to a hex file, works just fine. (LED's alternate) it's in a Velleman 8076 board. but if I compile the very same code in the IDE and load it via the Pickit3 i have, it loads ok.. but just doesn't run.. am I Missing somthing really obvious here? #include P16F628A.INC __CONFIG _BODEN_ON & _CP_OFF & _DATA_CP_OFF & _PWRTE_ON & _WDT_OFF & _LVP_OFF & _MCLRE_ON & _XT_OSC code COUNT1 EQU H'20' ;Used in delay routine COUNT2 EQU H'21' ; " " " RESET MOVLW B'00000111' ;Disable Comparator module's MOVWF CMCON ; BSF STATUS,RP0 ;Switch to register bank 1 MOVLW B'11010111' ;Set PIC options (See datasheet). MOVWF OPTION_REG ;Write the OPTION register. ; CLRF INTCON ;Disable interrupts MOVLW B'11000000' MOVWF TRISB ;RB7 & RB6 are inputs. BCF STATUS,RP0 ;****Turn the LED on**** Start movlw 07h ;Turn the LEDs on by first putting movwf PORTB ;it into the w register and then ;on the port ;****Start of the delay loop 1**** Loop1 decfsz COUNT1,1 ;Subtract 1 from 255 goto Loop1 ;If COUNT is zero, carry on. decfsz COUNT2,1 ;Subtract 1 from 255 goto Loop1 ;Go back to the start of our loop. ;This delay counts goto from ;255 to zero, 255 times ;****Delay finished, now f;iop swapf PORTB,1 ;it into the w register and then on ;the port ;****Add another delay**** Loop2 decfsz COUNT1,1 ;This second loop keeps the goto Loop2 ;LED turned off long enough for decfsz COUNT2,1 ;us to see it turned off goto Loop2 ; ;****Now go back to the start of the program goto Start ;go back to Start and turn LED ;on again ;****End of the program**** end ;Needed by some compilers, |
|
相关推荐
19个回答
|
|
|
|
|
|
当时我一点都没有…但我现在…仍然没有去。PIC在通过MPLABX编程时不会做任何事情,但是如果我使用MPASM和IPE,它将工作得很好。
以上来自于百度翻译 以下为原文 I didn't have a pull up at the time... but I do now.. and still no go. the PIC just won't do anything when programmed via MPLABx but will work fine if I use MPASM and the IPE |
|
|
|
更新。。我用PICTIT3和ICSP在我自己的板上遇到PIC16F1508同样的问题。
以上来自于百度翻译 以下为原文 update.. I'm having the same problem with a pic16f1508 in my own board using a PickIt3 and ICSP |
|
|
|
PIC16F628 A的配置字指定了一个“XT”振荡器,即一个外部晶体。你有吗?MPLAB和MPLABX之间的最大区别是MPLAB可以用其他东西来覆盖配置设置,MPLABX只使用您的代码上的内容。您使用PIC16F1508的配置设置是什么?
以上来自于百度翻译 以下为原文 The config words for the PIC16F628A specify an "XT" oscillator. i.e. an external crystal. Do you have one? The big difference between MPLAB and MPLABX is that MPLAB can override the CONFIG settings with something else, MPLABX only uses what is on your code. What config settings did you use with the PIC16F1508? |
|
|
|
使用输出端口上的异或指令,而不是交换小写。(其他引脚可能在使用中)iITMOVLW 0x10;4 ON,1 OffMOWWF PORTA…MOVLW 0X12XOWWF PORTA,1DISS10011001
以上来自于百度翻译 以下为原文 Use the exclusive or instruction on the output port instead of swapping the nibbles. (The other pins may be in use) init movlw 0x10 ;4 on, 1 off movwf PORTA ... movlw 0x12 xorwf PORTA,1 leds 10 01 10 01 |
|
|
|
源代码在CONTT2定义中有一个额外的引用(“”),因此剩余的代码显示为绿色,可能意味着它被解释为字符串文字而不是代码。这可能导致臭名昭著的RMW问题。最好使用影子寄存器,只对端口执行全字节写入。
以上来自于百度翻译 以下为原文 The source code has an extra quote (") in the COUNT2 definition, so the remaining code shows in green, perhaps meaning that it is interpreted as a string literal and not code. movlw 0x12 xorwf PORTA,1 That might cause the infamous RMW problem. Better to use a shadow register and only perform full byte writes to ports. |
|
|
|
高亮显示C,而不是汇编程序,所以它不知道是注释。试试这个版本(删除了一个错误的撇号):
以上来自于百度翻译 以下为原文 The highlighting assumes C, not assembler, so it doesn't know that is a comment. Try this version ( removed an errant apostrophe as well) :) #include P16F628A.INC __CONFIG _BODEN_ON & _CP_OFF & _DATA_CP_OFF & _PWRTE_ON & _WDT_OFF & _LVP_OFF & _MCLRE_ON & _XT_OSC code COUNT1 EQU H'20' ;Used in delay routine COUNT2 EQU H'21' ; " " " " RESET MOVLW B'00000111' ;Disable Comparator modules MOVWF CMCON ; BSF STATUS,RP0 ;Switch to register bank 1 MOVLW B'11010111' ;Set PIC options (See datasheet). MOVWF OPTION_REG ;Write the OPTION register. ; CLRF INTCON ;Disable interrupts MOVLW B'11000000' MOVWF TRISB ;RB7 & RB6 are inputs. BCF STATUS,RP0 ;****Turn the LED on**** Start movlw 07h ;Turn the LEDs on by first putting movwf PORTB ;it into the w register and then ;on the port ;****Start of the delay loop 1**** Loop1 decfsz COUNT1,1 ;Subtract 1 from 255 goto Loop1 ;If COUNT is zero, carry on. decfsz COUNT2,1 ;Subtract 1 from 255 goto Loop1 ;Go back to the start of our loop. ;This delay counts goto from ;255 to zero, 255 times ;****Delay finished, now f;iop swapf PORTB,1 ;it into the w register and then on ;the port ;****Add another delay**** Loop2 decfsz COUNT1,1 ;This second loop keeps the goto Loop2 ;LED turned off long enough for decfsz COUNT2,1 ;us to see it turned off goto Loop2 ; ;****Now go back to the start of the program goto Start ;go back to Start and turn LED ;on again ;****End of the program**** end ;Needed by some compilers, |
|
|
|
|
|
|
|
如果一个PIN处于模拟模式,或者过载,那么它将仍然失败。只有一个真正的影子寄存器将避免这种情况。
以上来自于百度翻译 以下为原文 movf PORTA,0 xorlw 0x12 movwf PORTA is functionally no different to movlw 0x12 xorwf PORTA,1 If a pin is in analog mode, or overloaded, then it will still fail. Only a true shadow register will avoid that. |
|
|
|
同样的事情,我只是因为保罗所说的。这个芯片上有什么影子寄存器?我已经有相当长一段时间没有做任何8位ASM了。
以上来自于百度翻译 以下为原文 Same thing but I just did because of what Paul said. What shadow registers are available on this chip? I haven't done any 8bit asm for quite a while. |
|
|
|
一个“影子寄存器”只是任何一个通用的RAM位置,你保存自己应该输出的端口。你在“影子寄存器”中操作位,然后将它复制到端口,所以你永远不会从端口寄存器中读取。这是一个软件技术,而不是硬件有限元。PIC的真实性。硬件版本是一个LAT寄存器,这正是他们在“增强”的8位部分现在可以使用的。
以上来自于百度翻译 以下为原文 A "Shadow register" is just any general purpose RAM location you maintain yourself to save what should be output by the port. You manipulate bits in the "shadow register" and then copy it to the PORT, so you NEVER do a read from the PORT register. i.e. this is a software technique, not a hardware feature of the PIC. The hardware version is a LAT register, which is exactly what they added in the "enhanced" 8 bit parts that are available now. |
|
|
|
|
|
|
|
是的,我知道这个技巧。当你说影子寄存器时,我想你的意思是在16位ASM中支持的实际影子寄存器。我习惯于16位ASM,我写的最后一段代码是GFX洪水填充函数——59条指令。
以上来自于百度翻译 以下为原文 Yeah I know the technique. When you said shadow registers I thought you meant the actual shadow registers that are also supported in 16bit asm. I'm used to 16bit asm, the last piece code I wrote was a gfx flood-fill function - 59 instructions. |
|
|
|
在复位向量中,从C.I.CITIT得到两个RelLW指令。;)
以上来自于百度翻译 以下为原文 Replace code with code 0x0000 or else you'll get two RETLW instructions from the .cinit at the reset vector. ;) |
|
|
|
|
|
|
|
读修改写。阅读thigtp//www. McCHIP.COM/FUMMS/M47 8014ASPX
以上来自于百度翻译 以下为原文 Read-Modify-Write. Read this http://www.microchip.com/forums/m478014.aspx |
|
|
|
通常用于描述BSF和BCF指令如何在端口寄存器上工作。也就是说,它们读取整个端口,修改一个比特,写入整个端口。如果从端口读取的值与上次写入的值不一样,这会导致意想不到的结果。一个地址可能会改变。如果某些引脚处于模拟模式,一些引脚仍在从最近的写入中改变(如果引脚上有明显的电容,可以采取多个指令),一些引脚具有高电流负载。例如一个带有小串联电阻的LED,耗电几十毫安。
以上来自于百度翻译 以下为原文 read-modify-write Usually used to describe how the BSF and BCF instructions work on PORT registers. i.e. they READ the entire port, MODIFY one bit, the WRITE the whole port. This can lead to unexpected results if the value read from the PORT is not the same as what was last written. i.e. pins other than the one addressed might change. That can happen if:
|
|
|
|
看起来代码0x000是个问题,它现在应该像现在一样闪烁。
以上来自于百度翻译 以下为原文 looks like the code 0x0000 was the problem. it's blinking like it should now. |
|
|
|
在与16F627 / 8图片的VelLeMin板I是使用XT OSC。在我自己的板上,这个特殊的应用程序与16F1508 I需要所有的I/O引脚,所以我现在使用的ItoSC。
以上来自于百度翻译 以下为原文 in the Velleman board with the 16f627/8 pics I was using an XT osc.. in my own board, this particular application with the 16f1508 I needed all of the i/o pins so I'm using the INTOSC for now. |
|
|
|
只有小组成员才能发言,加入小组>>
5183 浏览 9 评论
2005 浏览 8 评论
1932 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3178 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2229 浏览 5 评论
739浏览 1评论
626浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
510浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
637浏览 0评论
535浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-27 21:52 , Processed in 1.610675 second(s), Total 112, Slave 96 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号