silelis / ELM402_rotary_encoder_emulator

ELM402 rotary decoder software emulator written in C. Hardware Microchip PIC mcu's.
GNU General Public License v3.0
1 stars 0 forks source link

how to set up / troubleshoot? #1

Open thijsdeschildre opened 1 year ago

thijsdeschildre commented 1 year ago

Do I need to make any changes to the source code when I use a PIC12F629? I've compiled the code with the CCS compiler and I don't get any output. 0.45V on the output, all rotary encoder pins stay at 0v. Rotary encoder pullups and the pins for pulse width and invert are connected.

silelis commented 1 year ago

What is Your "device" after this command: #define device getenv("DEVICE") .

If should be equal to the chip that You want to flash with compiled binary.

Did you compiled with correct mcu include?

Are signal_B, signal_A, pulseWidth, outputInvert, output_UP , output_DOWN defined adequate to Your HW desing? If You have problem the best thing is to compile with "use_UPDOWN". I made it to see it inputs works correctly. If yest than disable "use_UPDOWN". One important thing. UART is very slow so do not turn encoder to fast because You will have martix read errors.

thijsdeschildre commented 1 year ago

yeah, I didn't have device getenv("DEVICE") set up. I was looking at the includes above, trying to figure out what to do. now I get errors when compiling. I'm using CCS C compiler. I have no idea if that works the same as the CCS PIC compiler.

`Compiling E:\ELM402_rotary_encoder_emulator-master\ELM402 emulator\ELM402_emu on 24-Apr-23 at 16:56 *** Error 27 "E:\ELM402_rotary_encoder_emulator-master\ELM402 emulator\ELM402_emu.c" Line 101(0,1): Expression must evaluate to a constant

*** Error 21 "E:\ELM402_rotary_encoder_emulator-master\ELM402 emulator\ELM402_emu.c" Line 112(0,1): #ENDIF with no corresponding #IF

*** Error 27 "E:\ELM402_rotary_encoder_emulator-master\ELM402 emulator\ELM402_emu.c" Line 114(0,1): Expression must evaluate to a constant

*** Error 21 "E:\ELM402_rotary_encoder_emulator-master\ELM402 emulator\ELM402_emu.c" Line 125(0,1): #ENDIF with no corresponding #IF

*** Error 27 "E:\ELM402_rotary_encoder_emulator-master\ELM402 emulator\ELM402_emu.c" Line 127(0,1): Expression must evaluate to a constant

*** Error 21 "E:\ELM402_rotary_encoder_emulator-master\ELM402 emulator\ELM402_emu.c" Line 150(0,1): #ENDIF with no corresponding #IF "UART OUTPUT"

--- Info 300 "E:\ELM402_rotary_encoder_emulator-master\ELM402 emulator\ELM402_emu.c" Line 122(5,9): More info: First Declaration of BOD`

silelis commented 1 year ago

Ok. To the begging. How do You firure out that there is no signal on output pins? Did you measure it via multimeter (voltage) or oscilloscope? The output signal is very short. It goes up and after 200 us it goes down. It is even not a blink of an eye. Only way to notice it is to connect other MCU with interrupt code or measure with oscilloscope.

silelis commented 1 year ago

The code is ready to compile for a list of pics in begging section of includes. Just uncomment that which you need and comment not required.