Microchip
直播中

王桂香

7年用户 221经验值
私信 关注
[问答]

程序计数器帮助

大家好!所以我决定把这个大的代码块变成一个子程序,我可以在需要的时候调用它,但是现在它不起作用了。最初,当我第一次编写代码时,它在我的启动代码中运行了一次,在0x2f开始。当我把它变成一个子程序时,我把它一直移到我的代码的起点,在0x7d开始。这个问题与这个代码中的一个表有关。表的代码基本上向PCL添加了偏移量,然后跳到RestLW某个值,但现在不这样做。在我的代码开始时,它跳到某个位置。我知道它在做什么和为什么,但是不知道如何补救。ADDWF PCL,F是指令0x11b,但是PCL显示0x1b。跳跃之后它在0x1c。这和PcLaTe有关系吗?我必须用PCL才能到达我需要的地方?我该怎么做?

以上来自于百度翻译


      以下为原文

    Hello everyone!

So I decided to turn this large block of code I have into a subroutine that I can call whenever I need it, but now it's not working. Originally, when I first wrote the code, I had it run once in my Start code where it started at 0x2F. When I made it a subroutine I moved it all the way to the end of my code where is starts at 0x7D.

The problem is related to a table I have in this code. The code for the table basically adds an offset to the PCL and then jumps to RETLW some value, but now it's not doing that. It's jumping to some position way back in the start of my code.

I know what it's doing and why, but don't know how to remedy this.

The ADDWF PCL, F is instruction 0x11B but the PCL is showing 0x1B. After the jump it's at 0x1C.

This has to do with PCLATH right? I have to use it with PCL to get to where I need to be? How do I do that?

回帖(6)

王焕树

2018-12-11 15:46:31
你为什么不提实际的PIC模型?

以上来自于百度翻译


      以下为原文

    Any reason you don't mention what actual PIC model you have?
 
举报

李维兴

2018-12-11 16:00:39
OP使用16F83:这里是HTTP://www. McCHIP.COM/FUMMS/FANDPOST/1024465,所以请看一下:HTTP://www. McCHIP.COM/FUMMS/FUNDSPAS/861818

以上来自于百度翻译


      以下为原文

    OP uses 16F883 here: http://www.microchip.com/forums/FindPost/1024465
 
So take a look to this: http://www.microchip.com/forums/FindPost/876718
 
举报

张润

2018-12-11 16:11:29
对不起的。我使用的是PIC16F83。我检查了你连接的其他线程,我仍然有点无能。数据手册和技术手册并不能很好地解释这一点。我发现PIC16F83只有4K内存,而不是8K。我被告知它有8K。所以这个PIC只有两页。在我问更多问题之前,我需要一些睡眠。

以上来自于百度翻译


      以下为原文

    Sorry. I'm using a PIC16F883.

I checked out that other thread you linked and Im still a bit clueless here.

The data sheet and tech manual doesn't explain this all that well.

I just found out that the PIC16F883 only has 4k memory, not 8k. I was told it had 8k.

So the this PIC only has two pages. I need some sleep before I ask more questions.
举报

蒋喜玲

2018-12-11 16:28:36
16F83有4K字闪光灯。因为一个字是14位,它几乎是8K字节。

以上来自于百度翻译


      以下为原文

    16f883 has 4K words flash. Since a word is 14bits, it's almost 8K bytes.
From section 2.3.1 in the datasheet concerning ADDWF PCL, F
举报

更多回帖

发帖
×
20
完善资料,
赚取积分