Quazee137
 Guru
 Joined: 07/08/2016 Location: United StatesPosts: 600 |
| Posted: 10:50am 22 Jun 2019 |
Copy link to clipboard |
 Print this post |
|
I am using a 170 Backpack to test a controllers inputs. Trying to simulate a pumps racing relay that goes from 30PPM to 12000 PPM. My first thought was the pulse command. But I can't get the pulse command working as I though it should. setpin 17,1000 should be sending a 1 sec wide pulse out until I change it. Right ???
For now I am using settick and toggling with pin(17)=not pin(17). I read + - on LCD and settick to half the pulse width and loop.
The idea here is to use the 170 backpack as a hand held tester. I have 4-20ma in and out working. Voltage meter 0 to 50VDC. WIP With an adjustable up converter to output 0 to 24VDC from two batteries. And four optocoupler inputs shared with four SSR outputs.
IT's fun watching a BIG (4-20ma) valve open and close while sliding a finger across the LCD.
A 2nd though has been for a breadboard companion with Freq in/out volt/current meter,8 inputs/outputs with just the 28 pinner.
These are projects that I'll post code and boards for when I get them debugged and tested.
After my current project putting a mite in a din rail box to add extended functions to a controller. Oh so many ideas here for later.
What do you thnk the best way to read PPM? I am playing with "COUNT" and "PIN". "COUNT" is working but "PIN" takes time to be valid. Quazee
Good got back in time to add this
Print "DualPumpSIM.bas" '21/06/2019 Quazee" Color RGB(black),RGB(white) CLS Font 1,4 SetPin 15, INTL, findkey ' touch interrupts pin SetPin 15, inth, getkey
SetPin 17,dout 'sim pump 1 out SetPin 18,dout 'sim pump 2 out
Pin(17)=0 Pin(18)=0
' 2000ms is 30 PPM so 1000ms per pulse half high... half low ' | 1000 | 1000 | 2000 | s7=1000 ' v_______v v_______ v______ s8=1000 '_____| |_______| |______|
SetTick s7,p7,1 SetTick s8,p8,2 Font 1,5 Text 220,10,"-" Text 270,10,"+" Text 220,100,"-" Text 270,100,"+" Font 1,4
Do
Text 5,100,Str$((1000/(s8*2)*60),1,2)+" " Text 5,10,Str$((1000/(s7*2)*60),1,2)+" " 'Box 10,65,300,30,5 'Box 10,155,300,30,5
Text 0,210,"30 50 80 100 200",,1,2,RGB(blue),RGB(green)
' + - adjustment If sy=0 Then Select Case k$
Case "4" s7=s7+(10*(s7<1100)) SetTick s7,p7,1
Case "5" s7=s7-(10*(s7>150)) SetTick s7,p7,1
Case "6" s8=s8+(10*(s8<1100)) SetTick s8,p8,2
Case "7" s8=s8-(10*(s8>150)) SetTick s8,p8,2
End Select k$="" End If
' coarse adjustment If sy Then Select Case sx Case 1 s7=1000 s8=1000 Case 2 s7=600 s8=600 Case 3 s7=375 s8=375 Case 4 s7=300 s8=300 Case 5 s7=150 s8=150 End Select SetTick s7,p7,1 SetTick s8,p8,2 sy=0:k$="" End If Loop
'bit togglers Sub p7 Pin(17)=Not Pin(17) End Sub
Sub p8 Pin(18)= Not Pin(18) End Sub
'crude inputs Sub findkey tx=Touch(x):ty=Touch(y) If tx=-1 Then Exit Sub If ty=-1 Then Exit Sub kx=tx\50:ky=ty\50 key = kx+ky sx=1+tx\64:sy=ty>200 End Sub
Sub getkey k$=Str$(key) End Sub
Edited by Quazee137 2019-06-23 |