_usec_delay(10_000)
end loop
The main loop of the program makes if you receive 128 on serial input, the 20 kHz PWM output increases its duty cycle up to 95%. If you receive a value of 64
the 20 kHz PWM output decreases its duty cycle up down to 5%.
To test this feature I remove the semicolonand and I simply put a wire on Pin_b4. When the wire is not connected I get the value 128 for mot_x and 64 when connected to gnd.
That means the program uses the "zoe" procedure and changes the PWM duty cycle regarding the value (128 or 64) associated with the state of
pin_b4.
What is not working is the serial input
With an external system (another PIC) I send continuously via the serial output the value 64 or 128 .
I checked with a serial tester and it shows on the input the values of 64 or 128 depending on what I wanted for the PWM output.
So the serial data for testing is OK.
I have also put the "
PIE1_RCIE = on ; Enables the USART receive interrupt" in the main program just at the beginning of the program ...nothing.
What is wrong?
Any help Welcome
THX
Patrick