Is the signal being read correctly - you are just reading a pin for RemoteUp, EndStopUp etc - check that you are getting 0 or 1...
|| and && do work correctly for OR and AND ...
Martin
Search found 1517 matches
- Sat Oct 11, 2025 10:47 am
- Forum: General
- Topic: Loop While!
- Replies: 19
- Views: 592
- Fri Oct 10, 2025 8:33 pm
- Forum: General
- Topic: Loop While!
- Replies: 19
- Views: 592
Re: Loop While!
Hi Jorgen, I'd recommend some parenthesis around the parts of the OR So if (A = 1) || (B = 1).... Alternatively - as A and B are 0 or 1 (RemoteUp and EndStop!) - declare them as boolean (true = 1 and false = 0) and then just if A || B ... (Use || for OR and && for AND - though bitwise OR sho...
- Fri Oct 10, 2025 8:21 pm
- Forum: General
- Topic: Analog value with I2C display ssd1306
- Replies: 4
- Views: 196
Re: Analog value with I2C display ssd1306
Hi Julian,
Something like this - it runs AOK in simulation - in hardware you might need to check the pins used (C0 for ADC for example)
Adding a SetFontScaler(2,2) makes the display easier to read! (from the gLCD component)
Martin
Something like this - it runs AOK in simulation - in hardware you might need to check the pins used (C0 for ADC for example)
Adding a SetFontScaler(2,2) makes the display easier to read! (from the gLCD component)
Martin
- Fri Oct 10, 2025 8:10 pm
- Forum: Projects - Embedded
- Topic: Setting Register Value in C Code
- Replies: 8
- Views: 4928
Re: Setting Register Value in C Code
Odd - I've just tested with a PIC18F46K80 as the target and: OSCCONbits.INTRF = 0b101; BRGCON1bits.BRP = 0b10001; Compiles okay - maybe been missed from the include for the MCU you are using? The alternative is something like (assuming BRP is bits 0..4) BRGCON1 = (BRGCON1 & 0b11100000) | DESIRED...
- Fri Oct 10, 2025 2:59 pm
- Forum: Projects - Embedded
- Topic: Setting Register Value in C Code
- Replies: 8
- Views: 4928
Re: Setting Register Value in C Code
The 'bits' refers to a bitfield
So for example OSCCONbits.ICRF = 0b101 would set three bits (ICRF<0..2> - on a sample PIC18F) would be my understanding - whereas OSCCONbits.ICRF0 would refer to a single bit.
Martin
So for example OSCCONbits.ICRF = 0b101 would set three bits (ICRF<0..2> - on a sample PIC18F) would be my understanding - whereas OSCCONbits.ICRF0 would refer to a single bit.
Martin
- Fri Oct 10, 2025 12:51 pm
- Forum: User Components
- Topic: FC components and AI (ideas?)
- Replies: 2
- Views: 11166
Re: FC components and AI (ideas?)
There are still some very disturbing 'errors' in the output. Sometimes the results are very good - and others - not so much. For example - I asked which pin to use for an interrupt - and it gave the wrong one, and then argued that I must be using an out of date datasheet (and old silicon). When I as...
- Thu Oct 09, 2025 9:05 pm
- Forum: General
- Topic: Loop While!
- Replies: 19
- Views: 592
Re: Loop While!
Yes - I think I follow: So maybe something along the lines of: In Up: Read RemoteUp Read EndStopUp If (RemoteUp == 1) && (EndStop == 0) // RemoteUp pressed and door isn't already up Loop Read RemoteUp Until RemoteUp == 0 // Wait for button to be released StartMotor to raise door Loop Read En...
- Thu Oct 09, 2025 3:27 pm
- Forum: General
- Topic: Loop While!
- Replies: 19
- Views: 592
Re: Loop While!
Hi Jorgen,
In 'Up' - it checks if RemoteUp = 1 then immediately does a loop PortB->RemoteUp while RemoteUp = 0 should this be until RemoteUp = 0?
Martin
In 'Up' - it checks if RemoteUp = 1 then immediately does a loop PortB->RemoteUp while RemoteUp = 0 should this be until RemoteUp = 0?
Martin
- Thu Oct 09, 2025 12:54 pm
- Forum: General
- Topic: Analog value with I2C display ssd1306
- Replies: 4
- Views: 196
Re: Analog value with I2C display ssd1306
You are constantly updating the display in a loop - this means it will refresh very rapidly probably with slightly different values. Try adding a delay. Also - if the value's representation changes in length (say '10' then '9') - it will not clear trailing digits. One way round this is to convert th...
- Sat Oct 04, 2025 10:21 am
- Forum: Bug Reports
- Topic: Slow I2C Component Macro [Solved]
- Replies: 3
- Views: 236
Re: Slow I2C Component Macro
In the i2c properties there is a 'stop delay' setting - check this is set to no.
Martin
Martin