This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

About AgsiSetSFRValue(DWORD dwValue)

hello,
I am engaged in developing a new SPeriDLL.dll(dialog) and I can't understand the following function and its specification:

BOOL About AgsiSetSFRValue(DWORD dwValue);

"This function is used to let the SFR read value C used to watch function with read access set for the SFR
Input Parameter
dwValue SFRReadValue;
return value:True if successful(otherwise FALSE)
EXAMPLE:
static void (void
{...
AgsiSetSFRValue(P1&PORT1);
...
}
"
I can't correctly understand the above explanation.can anybody give me more words?

thanks and best regards
huihl@163.com

Parents
  • you are right.I have gotten the newer version of note.pdf.
    when that function are called,the regiser P1 are not changed.But in the actual system,P1 would be changed on the PINS.
    since P1 were not changed,can the next read operation be exactly finished without setting the P1?

    thanks and best regards
    huihl@netease.com

Reply
  • you are right.I have gotten the newer version of note.pdf.
    when that function are called,the regiser P1 are not changed.But in the actual system,P1 would be changed on the PINS.
    since P1 were not changed,can the next read operation be exactly finished without setting the P1?

    thanks and best regards
    huihl@netease.com

Children
  • before reading input pins of P0 in target firmware,
    you need:
    1. call AgsiDefineVTR("PORT0") to get PORT0 handle on init.
    2. call AgsiWriteVTR(PORT0) to set PIN value

    Please note that VTR PORT0 (PIN value) is masked by SFR P0. You probably need to set SFR P0 to 0xff (all pins can be used for input) before reading input PORT0 PINs.
    For example, if current value of SFR P0 is 0x01 and your AGSI DLL call AgsiWriteVTR(PORT0, 0xff), debugger will show an error message.

  • I have this problem also, but I still can't understand. The example in app note shows
    AgsiSetSFRReadValue(P0 & PORT0); // P0 (Port0 SFR Value), PORT0 (Port0 pins)

    P0 is defined as 0x80 and PORT0 is VTR handle according to Jones Salivic's message. I can't understand how they can be logically or together. Could anybody explain more about this function ?

    Thanks and regards.

  • I don't understand either. Why are they ANDing the Port register address (0x80) with the port pins? How does that affect the return value? If I wanted to set pin 7, that would be the MSB of the value, which is 0x80, the port number... so how would the pin get set or cleared? Who wrote this function and what were they thinking? Why doesn't it take a register address and value?

    I'm really annoyed at this function because it *doesn't work*! I've tried calling it with 0xff, 0x00, and every combination in between, and the code always reads the SFR value....