Jump to content
Xtreme .Net Talk

EccentricDyslex

Members
  • Posts

    11
  • Joined

  • Last visited

About EccentricDyslex

  • Birthday 09/13/1970

EccentricDyslex's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Thanks PD. I have tried to add it as a reference via "project", "add reference", "browse" but am getting an error- dgb.dll could not be added, check its a valid assemebly or COM componant... Any ideas? Steve
  2. Thanks for the advice chaps. PD, can i ask, if i put the dll in the same application folder, will VS publish it along with the app via click once? or does this have to be manualy copied over to the new machine? dT, the dll is supplied by the vendor of the device i am instructing in the vb program. The vendor states this must be copied into the system32 folder for the device to work. I am not sure if the dll controls the device or not...im not that knowledgable just yet lol. Can you explain what setting reference properties to local copy does? It would be ideal if i didnt have to install the dll to system32 and just distribute it with the app in the apps own folder if possible. Cheers! Steve
  3. Its not ideal but at least its a step forward. How do i go about doing that instead? cheers steve
  4. I have a program written in vb on vs2010 which i have published to a NAS. The program requires "dgb.dll" (a custom dll) to be in the local PC's windows/system32 folder. How do i get vs2010 to get the published clickonce file to install this automatically and in the correct place? (also needs to be installed in wow64 for 64bit systems) I have been through much online info about prerequisites, bootstraps and references but am struggling to make much sense of it all...can someone point me towards a walk through or maybe walk me through it here? Many thanks! Steve
  5. Thanks Snarf, works a treat! It was good a learing process to learn a bit about strings anyway. Basicaly an integer can be expresed in many ways i guess, and it is stored as bits anyway if that right? I had been looking all over the net looking for ways how to convert an int to a bin, but MS didnt have a function for this...now i see why...it already can be done by looking at bit values! I had wondered if there was an easier way of doing group operations like checking a number of check boxes the way i had...thats very useful, thanks! Steve
  6. Sorry to bombard you with questions! I have a variable that registers diferent values dependant on a varying voltage. The voltage relates to a temperature sensor (LM335Z). My question is this.. once i have 2 referance figures for 0C and 100C say, if these two figures are 106 and 253 respectivly, how can i then interpolate these to a variable that truly reflects the actual temperature being sensed so i can then display it or use it in other ways? Many thanks! Steve
  7. Hi Snarf, i have found the original problem, so have it working. I am interested in your other method though, the integer is converted into a binary string by the function i found on the net. is it easy to turn that string into a binary number so the individual 1s and 0s can be analized? cheers steve
  8. Hi all, i have a problem with the code below. Basicaly i have an integer that i need to convert to binary and show the results in check boxes. The code below takes the integer, converts it to a binary string, then depending upon where the "1"s are, will check the apropriate check box on the UI. The binary number returned has a max of 16 digits and a min of 0, so hence the 16 checkboxes. The problem i am having is the code runs fine counting down from the left most "1" (int32768) with all the others to the right as "0"s. Halfing the int each cycle should result in the "1" moving along the checkboxes until it reaches the right most position. But its working fine down to box 9, but then it disapears! Any ideas? CODE- intInputs = 32768 'convert intinputs to binary strInputs = dec2baseN(intInputs, 2) 'find length of strInputs intLengthofinputsstring = Len(strInputs) 'find difference between strinputs and 16 so we know how many "0"s to add to the left of the string to keep everything in line Dim difbetweenstrinputsand16 As Integer difbetweenstrinputsand16 = 16 - Len(strInputs) 'if strInputs is less than 16 digits long, add 0s to the left of the string to make length always 16 digits long If difbetweenstrinputsand16 > 0 Then For a = 1 To difbetweenstrinputsand16 - 1 strInputs = "0" & strInputs Next End If 'clear all checkboxes CheckBox1.Checked = False CheckBox2.Checked = False CheckBox3.Checked = False CheckBox4.Checked = False CheckBox5.Checked = False CheckBox6.Checked = False CheckBox7.Checked = False CheckBox8.Checked = False CheckBox9.Checked = False CheckBox10.Checked = False CheckBox11.Checked = False CheckBox12.Checked = False CheckBox13.Checked = False CheckBox14.Checked = False CheckBox15.Checked = False CheckBox16.Checked = False 'analise the 16digit binary string and if any of the binary digits are ones, then check the related checkbox Dim temp As Integer For count = intLengthofinputsstring To 1 Step -1 temp = Microsoft.VisualBasic.Mid(strInputs, count, 1) If temp = 1 And count = 16 Then CheckBox1.Checked = True If temp = 1 And count = 15 Then CheckBox2.Checked = True If temp = 1 And count = 14 Then CheckBox3.Checked = True If temp = 1 And count = 13 Then CheckBox4.Checked = True If temp = 1 And count = 12 Then CheckBox5.Checked = True If temp = 1 And count = 11 Then CheckBox6.Checked = True If temp = 1 And count = 10 Then CheckBox7.Checked = True If temp = 1 And count = 9 Then CheckBox8.Checked = True If temp = 1 And count = 8 Then CheckBox9.Checked = True If temp = 1 And count = 7 Then CheckBox10.Checked = True If temp = 1 And count = 6 Then CheckBox11.Checked = True If temp = 1 And count = 5 Then CheckBox12.Checked = True If temp = 1 And count = 4 Then CheckBox13.Checked = True If temp = 1 And count = 3 Then CheckBox14.Checked = True If temp = 1 And count = 2 Then CheckBox15.Checked = True If temp = 1 And count = 1 Then CheckBox16.Checked = True Next 'divide intInputs by2 to move the "1" along by one step intInputs = intInputs / 2 then i loop this code 16 times. Any ideas? Cheers! Steve
  9. Noted. Cheers Steve
  10. Hot to worry, i got there in the end! I just had to remove the do-loops and all is well! Steve
  11. Hi, i am automating a home brewery, i have come up with the following code, can someone go over it and pick out why its not working? Thanks! Public Class Form1 'Declare variables Private selecteddate As Date Private timeokpressed As Date Private boilstartedtime As Date Dim mashvolume As Integer Dim boillength As Integer Dim mashlength As Integer Dim boilvolume As Integer Dim differencebetweenmashvolumeandthirtyoneminutes As Integer 'digibee+ declare functions Declare Function InitDgb Lib "dgb.dll" () As Boolean Declare Function SetOutputs Lib "dgb.dll" (ByVal outputs As Integer) As Boolean Declare Function ReadInputs Lib "dgb.dll" (ByRef inputs As Integer) As Boolean Declare Function ReadAnalogueInputs Lib "dgb.dll" (ByRef aip1 As Integer, ByRef aip2 As Integer, ByRef aip3 As Integer, ByRef aip4 As Integer) As Boolean Declare Function SetSensitivity Lib "dgb.dll" (ByVal HighNorm As Integer) As Boolean Private Sub startimer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStarttimer.Click lblStatus.Text = "Waiting until it's 2 hours before requested mash-in time." 'inisialises digibee+ (removedfornow) Do If Date.Now.ToShortTimeString = selecteddate.AddHours(-2).ToShortTimeString Then lblStatus.Text = "2 hours before mash-in time. Heating mash liquor. relay 1 on(HLTPID)" : Exit Do 'turns on output relay 1 to operate HLTPID setoutputs(1) (removed for now ) End If Loop Do If Date.Now.ToShortTimeString = selecteddate.AddMinutes(-31).ToShortTimeString Then lblStatus.Text = "31mins before mashin time, filling mash tun. relays 1 & 3 on (HLTPID & PP1)" : Exit Do 'Turns on output realys 1 & 3 to operate HLTPID & PP1 :setoutputs(3) (removed for now) End If Loop Do If Date.Now.ToShortTimeString = selecteddate.AddMinutes(-differencebetweenmashvolumeandthirtyoneminutes).ToShortTimeString Then lblStatus.Text = "waiting " & differencebetweenmashvolumeandthirtyoneminutes & " minutes which will then be mash in time." : Exit Do 'will keep relays 1&3 on until mashvolume has been pumped into mash tun Loop lblStatus.Text = "RIMs on" 'Turns on output realys 8,4,3 & 1 to operate HLTPID, MM1, V1 & MashPID :Setoutputs(282) (removed for now) Do If Date.Now.ToShortTimeString = selecteddate.ToShortTimeString Then MsgBox("Ready for you to mash-in. Press ok when you have mashed in, topped up the HLT, fitted the RIMs manifold and filled the hop hoppers with hops as you require. Dont forget the protofloc!") : Exit Do End If 'Notifies brewer that the mash tun is ready for mashing in. When OK is pressed program will move on to the next instruction. Loop timeokpressed = Now 'notes what time ok was pressed Do If Date.Now.ToShortTimeString = timeokpressed.AddMinutes(mashlength).ToShortTimeString Then lblStatus.Text = "Mash finished, starting sparge." : Exit Do 'waits for mashlength to expire Loop 'setoutputs(19) when mashlength has expired, will open relays 5,2 and 1 thats pp1, pp2 and HLTPID and turn off MashPID and MM1 (removed for now) Do If Date.Now.ToShortTimeString = timeokpressed.AddMinutes(boilvolume).ToShortTimeString Then lblStatus.Text = "Turning off HLTPID to prevent run-dry." : Exit Do ':setoutputs(100) turns off hltpid and on boilpid halfway through sparge as boiler is half full. 6,5 & 2 pp1, pp2 and boilpid on (removed for now) Loop Do If Date.Now.ToShortTimeString = timeokpressed.AddMinutes(boilvolume * 2).ToShortTimeString Then lblStatus.Text = "Sparge complete, starting boil. Bittering hopper open." : Exit Do ':setoutputs(1088) relays 10 & 6 open boilPID and bittering hops hopper opened. will close pp1, pp2 and hltpid relays(removed for now) Loop boilstartedtime = Now Do If Date.Now.ToShortTimeString = boilstartedtime.AddMinutes(boillength - 10).ToShortTimeString Then lblStatus.Text = "Opening 10 min hops hopper." : Exit Do ':setoutputs(2112) relays 11&6 10min hopper & boilPID Loop Do If Date.Now.ToShortTimeString = boilstartedtime.AddMinutes(boillength - 5).ToShortTimeString Then lblStatus.Text = "Opening 5 min hops hopper." : Exit Do ':setoutputs(4160) relays 12&6 min hopper & boilPID Loop Do If Date.Now.ToShortTimeString = boilstartedtime.AddMinutes(boillength).ToShortTimeString Then lblStatus.Text = "Opening 0 min hops hopper and stoping the boil." : Exit Do ':setoutputs(8192) relay 13 ON 0 min hopper open and boilPId OFF Loop Do If Date.Now.ToShortTimeString = boilstartedtime.AddMinutes(boillength + 5).ToShortTimeString Then lblStatus.Text = "Closing 0 min hops hopper, steeping for 15 minutes." : Exit Do ':setoutputs(0) all relays off Loop Do If Date.Now.ToShortTimeString = boilstartedtime.AddMinutes(boillength + 20).ToShortTimeString Then lblStatus.Text = "Aroma hop steep completed. Comencing wort cooling and transfer to fermentation vessel." : Exit Do ':setoutputs(640) relays 7&9 on, PP3 and V2 on Loop Do If Date.Now.ToShortTimeString = boilstartedtime.AddMinutes(boillength + 80).ToShortTimeString Then lblStatus.Text = "Wort transfer compeleted." : MsgBox("Your beer is ready for you to pitch the yeast!") : Exit Do ':setoutputs(0) relays all off Loop Timertwohoursbeforemash.Interval = 60000 Timertwohoursbeforemash.Enabled = True End Sub Private Sub Timertwohoursbeforemash_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timertwohoursbeforemash.Tick End Sub Private Sub nudMashvolume_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nudMashvolume.ValueChanged mashvolume = nudMashvolume.Value differencebetweenmashvolumeandthirtyoneminutes = (31 Mod mashvolume * 2) End Sub Private Sub nudBoilvolume_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nudBoilvolume.ValueChanged Boilvolume = nudBoilvolume.Value End Sub Private Sub nudBoillength_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nudBoillength.ValueChanged boillength = nudBoillength.Value End Sub Private Sub Label7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label7.Click End Sub Private Sub dtp1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dtp1.ValueChanged selecteddate = dtp1.Value End Sub End Class
×
×
  • Create New...