Last Post Variable Number Nb_varSV

Community forum for discussion and support of the PINK product and development kit
Mike2545
Posts: 44
Joined: Wed Aug 20, 2014 6:07 pm

Last Post Variable Number Nb_varSV

Post by Mike2545 » Fri Aug 26, 2016 12:25 pm

I have tried several different ways but I cannot get Nb_varSV to give me the correct variable that was edited and posted on the web page. Does this feature work for anyone else?
Last edited by Mike2545 on Sat Jan 14, 2017 12:49 pm, edited 1 time in total.

Mike2545
Posts: 44
Joined: Wed Aug 20, 2014 6:07 pm

Re: Last Post Variable Number

Post by Mike2545 » Sat Jan 14, 2017 12:46 pm

Yeah, Last Post Variable Number "Nb_varSV" is not working in the latest firmware release.


Mike

User avatar
TomNB
Posts: 400
Joined: Tue May 10, 2016 8:22 am

Re: Last Post Variable Number Nb_varSV

Post by TomNB » Sat Jan 14, 2017 2:07 pm

We will take a look at it on Monday. Is the value you see a number or FF? Which register values, 0-99 are you posting to?

Mike2545
Posts: 44
Joined: Wed Aug 20, 2014 6:07 pm

Re: Last Post Variable Number Nb_varSV

Post by Mike2545 » Sat Jan 14, 2017 4:35 pm

Tom,
I only read NbvarSV after NbvarST (bit 1) tells me a var got updated

If I read the NbVarSv like this

Code: Select all

SEROUT2 pinkTX, pinkBaud, ["!NB0SV"] ' Command To Read Last post
SERIN2  pinkRX, pinkBaud,PauseBit,timeout2,[Nb_varSV]
it goes to FF on the /VV_Show.htm page, like it should.
and Nb_varSV is a random number.

If I read it after a pause like this :

Code: Select all

PAUSE 10000
SEROUT2 pinkTX, pinkBaud, ["!NB0SV"] ' Command To Read Last post
SERIN2  pinkRX, pinkBaud,PauseBit,timeout2,[Nb_varSV]
so I can refresh the /VV_Show.htm page, wait for the pause and see what Nb_var returns; its the same random number on both.

It is never the number corresponding to the web page var that was changed .
I have been testing with:
Nb_var02
Nb_var12
Nb_var22
Nb_var73
Nb_var83

Using this on then PINK /index.html page to post.

Code: Select all

<form Method = "post" action ="/index.html">

Mike

User avatar
TomNB
Posts: 400
Joined: Tue May 10, 2016 8:22 am

Re: Last Post Variable Number Nb_varSV

Post by TomNB » Tue Jan 17, 2017 3:36 pm

Hi Mike,

I think what may have been happening is a value of 0xFF was having a problem when sent to the telnet debugging port. We made a code change to print the value as a string instead of a binary 0xFF. Please let me know if the attached code will work for you.
Attachments
PINK-R1p47Beta-20170117.zip
(379.9 KiB) Downloaded 187 times

Mike2545
Posts: 44
Joined: Wed Aug 20, 2014 6:07 pm

Re: Last Post Variable Number Nb_varSV

Post by Mike2545 » Wed Jan 18, 2017 6:35 am

Tom, that version causes the NbvarST to register a change all the time (even though there is not)


Mike

User avatar
TomNB
Posts: 400
Joined: Tue May 10, 2016 8:22 am

Re: Last Post Variable Number Nb_varSV

Post by TomNB » Wed Jan 18, 2017 9:52 am

I'm not seeing that in our tests for some reason. It will register a change until it is read. Can you provide the command sequence that shows the case you are referring to?

User avatar
TomNB
Posts: 400
Joined: Tue May 10, 2016 8:22 am

Re: Last Post Variable Number Nb_varSV

Post by TomNB » Wed Jan 18, 2017 10:28 am

Here is our test sequence.

----- Main Menu -----
1 - Write Static IP settings
2 - Clear Static IP settings
3 - Write HTTP Port Number
4 - Read status register (!NB0ST)
5 - Read last modified variable (!NB0SV)
6 - Write variable 6 to a value of 6 (!NB0W06:06)
7 - Read variable 6 (!NB0R06)
R - Send Reset Command
S - Get PINK system status

4 Reading status byte: 0x01
5 Reading last var changed: 0xFF
6 Writing NB_var06:
4 Reading status byte: 0x03
4 Reading status byte: 0x01
5 Reading last var changed: 0x06
5 Reading last var changed: 0xFF
7 Reading NB_var06 = 06

Mike2545
Posts: 44
Joined: Wed Aug 20, 2014 6:07 pm

Re: Last Post Variable Number Nb_varSV

Post by Mike2545 » Wed Jan 18, 2017 11:16 am

Tom, the beta firmware registers 3 on this command at every read

Code: Select all

   SEROUT2 pinkTX, pinkBaud, ["!NB0ST"] ' Command To Read status Register
    SERIN2  pinkRX, pinkBaud,PauseBit,timeout2,[Nb_varST]
      if Nb_varST = 3   then gosub Read_PINK 




Nb_varST is the PINK Status Register. This is a read-only variable. Reading this variable clears
bits 1, 4 and 5.

o Bit0 is the Network Status bit. This bit is set if a network connection is detected and
cleared otherwise.
o Bit1 is the Variable Update bit. This bit is set if a variable has been updated via the web
page (HTTP POST method) since the last read of the Status Register.
o Bit2 is the Email busy status bit. This bit is set if the PINK is busy sending email and
cleared when it is ready to send. This bit changes automatically but is cleared after the
mail is sent or fails. This bit is not affected by the Send Test Email link in the Modify
Variables web page.
o Bit3 is not used.
o Bit4 is the Email complete status bit. This bit is set when email was successfully sent.
This bit will be cleared when the Status Register is read or when the next email fails.
o Bit5 is the UDP Message received status bit. This bit is set when a UDP Message is
received. Reading the Status Register will clear this bit.
o Bit6 is not used.
o Bit7 is not used.
Mike

User avatar
TomNB
Posts: 400
Joined: Tue May 10, 2016 8:22 am

Re: Last Post Variable Number Nb_varSV

Post by TomNB » Wed Jan 18, 2017 12:45 pm

Hi Mike,

That seems to be inconsistent with our test as you can see the two #4 reads in the test output from the previous post. What do you think?

Post Reply