Microchip
直播中

刘御

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

将汇编代码从17c756移植到16f1719时出现问题

嗨…我试图把一些汇编代码(合理的复杂度)给17C176到16F1719,并且有字大小的问题。17C代码使用RES指令在RAM组中分配内存,它指定要分配的字节数。例如,温度Res 2与16F分配2字节,相同的语句分配2个字。我找不到另一个分配字节的指令:似乎DB指令只能用于“代码”(即初始化常数)。不幸的是,我们使用的是MPASM 5.73,所有的银行都是满的,并且没有足够的空间来存储两个字节以用于单个字节变量,所以我需要找到一种在存储的RAM中声明单个字节的方法。有人知道怎么做吗?我怀疑我忽略了一些显而易见的东西。

以上来自于百度翻译


      以下为原文

    Hi..
I am trying to port some assembly code (of reasonable complexity) for a 17c756 to the 16f1719,
and have an issue with word size.
The 17c code used the RES directive to allocate memory in the RAM banks, which specifies the number
of bytes to allocate. E.g.  TEMPERATURE RES 2   allocates 2 bytes
With the 16f, the same statement allocates 2 WORDS. I couldn't find an alternative directive to allocate
bytes: it seems as if the DB directive can only be used for 'CODE' (i.e. initialised constants).
We are using MPASM 5.73
Unfortunately, all of the banks are quite full, and there isn't enough space to reserve two bytes for each
single byte variable, so I need to find a way of declaring single bytes in the banked RAM.
Does anyone know how to do this? I suspect that I have overlooked something embarassingly obvious.

回帖(11)

李兆峰

2019-3-4 07:39:09
嗯,我很确定RES在PIC16S上分配了正确的字节数。

以上来自于百度翻译


      以下为原文

    Mmm, I am pretty sure that RES allocates that exact number of bytes on PIC16s...
举报

tijing忽忽

2019-3-4 07:46:00
不确定你所说的“2字”是什么,它将在RAM中分配2个地址,这些地址是用字节来处理的,所以它将是在那个标签上保留的2字节RAM。

以上来自于百度翻译


      以下为原文

   
Not sure what you mean by "2 WORDS", it will allocate 2 addresses in the RAM, which is addressed in bytes,so it will be 2 bytes of RAM reserved at that label.
举报

李维兴

2019-3-4 07:56:56
不,它应该按字节分配。

以上来自于百度翻译


      以下为原文

   
No, it should allocate in bytes.
举报

tijing忽忽

2019-3-4 08:03:35
可能有些混淆来自于在MPASM指南中描述RES指令的这一行:我认为这指的是FLAS/ROM中的分配,而不是RAM中的分配。

以上来自于百度翻译


      以下为原文

    Possibly some confusion comes from this line in the description of the RES directive in the MPASM guide:

I think this refers to allocation in FLASH/ROM but NOT in RAM....
举报

更多回帖

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