Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - uknanoman

Pages: 1 [2]
16
Technical support / Re: goto command
« on: December 21, 2022, 12:00:30 AM »
Hi Gary
          Thanks for the helpful response. Yes I understand your approach and it was a way I originally considered and the reason I was looking for a more simplified textual layout was because within the code sections there are / would be, many more nested ifs. In my example I only showed if branches for 1,2,3 and 10 but in reality there will be about 35 - 40 branches. So my thinking was that by using the goto command I would achieve two things. Firstly all the multiple if / elif / elseif chain would be reduced to one simple line that just reads - goto @xx where xx represents the sequence number. Secondly all the code for each section would then be headed with a @xx and this in my mind grouped in simple chunks of text, each sequentially following the other until coming to the last ‘@40’ label. I realise you get this as I have always been impressed with your many posts over the years so I am really only explaining this in more detail for others who may be wondering what an why I am wittering on about. As so often happens, the process of posting a tech question makes one re-evaluate ones thought process. With this in mind it may be better for me to call up say 40 custom functions from the if elseif chain and segregate my code by custom function rather than by a goto label. Any thoughts ?
Once again thanks for your help
All the best
Pete

17
Technical support / goto command
« on: December 20, 2022, 10:42:46 AM »
Hi Tech
I am just doing a routine where I need to branch off within a custom function using the goto command. I have a register which holds my Sequence number and is updated
according to other factors in the program. This is named as SeqNo and is assigned to a dm[xx] register. Now everything works fine using multiple ifs and goto @xx but the text can get
very long using either if or an elseif variation.  Anyway I tried to use the following line so as to get rid of all the ifs

Goto @SeqNo

But this gave me an error. So then I tried

a$="@"+chr$(SeqNo)
goto a$         

This did not work either so any help would be appreciated.


These lines below show what I am trying to reduce if possible.

if SeqNo = 1
goto @1
endif

if SeqNo = 2
goto @2
endif

if SeqNo = 3
goto @3
endif

if SeqNo = 10
goto @10  '
endif

@1
code for this routine
EXIT

@2
code for this routine
EXIT

@3
code for this routine
EXIT

@10
code for this routine
EXIT

18
Technical support / Re: EEprom Cycles for a data log
« on: November 29, 2022, 10:33:20 AM »
Hi Tech
          Thanks for this prompt response. I have used the Fram before on Nano's but it does not look like there is anywhere
left to plug into as I already have the TERM8 I/O Board fitted. Having said this I noticed that there are 4 reserved pins on
the header, is there a way the standard FRAM RTC can be utilised with these pins?

Regards uknanoman
 
 

19
Technical support / EEprom Cycles for a data log
« on: November 29, 2022, 01:50:29 AM »
Hi Tech
          I am currently using your new wx100 series to develop a control system for a silo filling control system. One of my requirements is to be able to log data as various events happen,
currently for each event I have used the code below - albeit with varying text on the end according to the event - to write the data to the EEprom area

X$ = STR$(DATE[3])+ " "+STR$(DATE[3])+" "+STR$(DATE[2])+ " "+STR$(DATE[1])+ " "+STR$(TIME[2])+ ":"+STR$(TIME[3])+ " "+ "Enter Button Activated"
Save_eep$ X$,Datalogpointer
Call Incdatalogpointer

The datalogpointer variable simply gets incremented by every call to Incdatalogpointer and eventually reset after say 100 datalogs.
this seems to work ok apart from some strange goings on of the eeprom manager when reading back what I have written.

My question is twofold
1) How many times on the wx100 can the eeprom be written / rewritten
2) Is this the fastest way to do it as I notice a delay in the plc scan cycle when actuating this code

 


Pages: 1 [2]