If you are going to set "WEAK" to a value in a program, it needs to be a variable (bit, byte, word) or a pin. "symbol WEAK = 0" makes WEAK a constant (can't be changed) with a value of 0.
I'm still not exactly sure what you are attempting to do with which pins in response to what event. Can you explain that further?
DING! OK, that light just came on!
THANK YOU!
(Like I said... it was probably staring me in the face, but I wasn't seeing it! )
Changing that to use...
Code:
symbol WEAK = bit4 ;Input for WEAK Signal warning
symbol RED = pinc.0 ; Red LED
main:
pause 10 ; Slow things down a bit
WEAK = not pinb.7 ; Invert input so a LOW (active) input = 1
RED = WEAK ; Light the LED if input goes low
goto main ; Loop forever
...is working!
As for what I'm doing, I'm glad you asked.
It's for a satellite receiver system here at the radio station I work for. (WIHS FM in the USA) I'm building a "status display" system that will react to various status line outputs from that receiver, and a reset button for users to temporarily stop the flashing lights. (So they won't be distracted while they go on the air to read news or weather.)
There are three outputs from the receiver: "Weak signal", "No Signal" and a "Moody Network Message alert". The "Message Alert" lets us know that the satellite network has sent out an e-mail with important information about something on the network. (It is called "Moody" because it is named after the famous Evangelist, D.L. Moody.)
The "Message Alert" is only a momentary "LOW" input, so it needs to "latch" a blue LED on. (I have that part working, I'm working on getting the RESET button to clear it, now.)
The "Weak" input will light a yellow LED and the "No signal" input will light a bright red flashing module.
The RESET button will only PAUSE the flashing for 4 minutes. (A smaller red LED will always be lit.) The flashing will resume, as long as the "NO SIGNAL" input is still active. Only clearing the problem will stop the alarm. (When the satellite dish gets snow in it, it affects the signal. We need to alert someone to get out there and sweep it out!)
When there are no active inputs, a white LED glows. ANY active input extinguishes it... this will be more for diagnostics than actual use. I'm considering just using the GREEN one... this whole thing is only in the very earliest stages of development right now.
For anyone that is curious, here is the program, as it exists now... the inputs & LED's are working... the blue latches, but I haven't figured out the reset code to "un-latch" it, just yet. This is only VERY early in the development process!
Code:
#no_data; Don't update EEPROM areas to save upload time
#picaxe 20m2;Force compiler mode to the correct chip
;-----------------------------------------------
; This program is written for the 20M2 chip by Willie...
; Started: 02/06/2017
; Last updates: V0.00 ~ 2/15/17
; Current Version & Date: V0.01 - 2/20/17 - Tweak date: 3/1/17
; Working on I/O 3/1/17 - No VERSION increments until more advanced
;-----------------------------------------------
start:
sertxd("Sat System Alerter V0.01",cr,lf);Identify chip program at power-on
let dirsb = %00000000 ; set port b as inputs
let dirsc = %11111111 ; set port C to outputs
pullup on ; Turn on the internal pullup resistors for inputs
symbol BLU = pinc.5 ; Blue LED ; Lights if there has been a "Moody Message Alert"
symbol WHT = pinc.4 ; White LED ; Used to indicate any input active for diagnostic/testing
symbol FLASHER = pinc.3 ; Big flashing indicator, resettable for 4 mins until alert cleared.
symbol GRN = pinc.2 ; Green LED Steady = OK (possible changes coming)
symbol YEL = pinc.1 ; Yellow LED (currently lights for more than one active input)
symbol RED = pinc.0 ; Red LED (NO SIGNAL Warning indicator, stays on until cleared)
symbol MOODYLIGHT = b3 ;Variable to "latch" the blue light
symbol MOODY = bit1 ; Input for Moody Message Alert relay
symbol RSET = bit2 ; Input for reset button (Only pauses the flasher for 4 mins & clears Moody Msg Alert)
symbol FAULT = bit3 ; Input for NO SIGNAL WARNING (Flasher & red LED)
symbol WEAK = bit4 ; Input for WEAK Signal warning (Yellow LED)
main:
pause 100 ; Slow things down a bit
WEAK = not pinb.7 ; Invert inputs so a LOW (active) input = 1 (Applies to all 4)
FAULT = not pinb.6
RSET = not pinb.5
MOODY = not pinb.4
FLASHER = FAULT ; Flash the big light if NO SIGNAL
GRN = RSET ; (Temporarily, lights when the reset button is pressed)
let b2 = MOODY ;For latching logic
if b2 = 1 then
MOODYLIGHT=1 ; Turn on the LED if this input is active
endif
RED = WEAK ; Using RED LED for now
let B1 = FAULT | RSET | MOODY | WEAK ; White LED goes dark if ANY input is active
WHT = not b1
let b4 = FLASHER + GRN + MOODYLIGHT + RED ; Add up the number of active inputs
YEL = 0
if b4 > 1 then ; Light the YELLOW LED only if more than one input is active (Temporary diagnostic tool)
YEL = 1
endif
BLU = MOODYLIGHT ; LED follows latch variable status
if b2=1 and RSET = 1 then ;This should clear the BLU LED with RSET but isn't
b2=0
MOODYLIGHT=0
endif
goto main
Only 4 emoticons per message? Interesting.
Willie...