I am sorry, but, the code you posted does what it is intended to do.
In step 2 you set the port to b'00010000' then you rotate. If the sim does not work... then, real hardware will.
Let me show.... I have adapted your code adding some serial debug (which you can remove or use) and then I set portb to the value of porta when you initialise it....
Seems to work as expected. Something Bill Roth (a seasoned PIC developer) taught me... do not trust a simulator the real test is the real hardware.
But, I may be wrong but I think not.
#chip 16f716, 20dirPORTAoutdirPORTBoutdimBugasByte#include<softserial.h>;-----ConfigSerialUART:#define SER1_BAUD 9600 ; baudrate must be defined#define SER1_DATABITS 8 ; databits optional (default = 8)#define SER1_STOPBITS 1 ; stopbits optional (default = 1)#define SER1_INVERT Off ; inverted polarity optional (default = Off);ConfigI/Oportsfortransmitting:#define SER1_TXPORT PORTB ; I/O port (without .bit) must be defined#define SER1_TXPIN 7 ; portbit must be defined;ConfigI/Oportsforreceiving:#define SER1_RXPORT PORTB ; I/O port (without .bit) must be defined#define SER1_RXPIN 6 ; portbit must be defined#define SER1_RXNOWAIT Off ; don't wait for stopbit optional (default = Off)'Step1WorkSer1Send13'newlineinTerminalSer1Send10'Ser1Print"Step 1 Work"PORTA=b'00000001'portb=portarepeat4RotatePORTALeftSimplewait500msendrepeat'Step2WorkSer1Send13'newlineinTerminalSer1Send10'Ser1Print"Step 2 Work"PORTA=b'00010000'portb=portarepeat4RotatePORTARightSimplewait500msendrepeat'Step3WorkSer1Send13'newlineinTerminalSer1Send10'Ser1Print"Step 3 Work"PORTA=b'00010000'portb=portaBug=PORTArepeat4RotateBugRightSimplePORTA=Bugwait500msendrepeat
Yes, simulators are evil. Provoke stupid posts on the forum :) I Write a program, and the prototype is not ready yet, so I decided to use the simulator. He caused trouble. Once again, thank you very much for your response.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello! I can not understand in what business, not working a shift right on PORTA PIC16F716. This is because he is a 5-bit?
Last edit: Anobium 2019-03-16
Hello and Welcome.
This is working. The code set the port high in turn as follows: porta.3.. 2. 1...0 leaving Porta.0 high.
I have used a simulator - but, this code is good code.
What is happening ?
Last edit: Anobium 2019-03-16
Thank you!
This code work -
PORTA = b'00001'
repeat 4
Rotate PORTA Left Simple
wait 500 ms
end repeat
but shift to the Right not. Value on PortA not change, PortA.4 only set to 0.
Temporarily I made so
But I would like to know what is wrong.
I do not understand. What is actually happening?
There is no bug. Please post the actual code and describe what is, and what is not happening.
Tried in hardware, everything works. Probably a mistake in my simulator. In vain raised panic :)
Thank you very much for your response!
This code does not work in the simulator
https://youtu.be/uP5JungwQqU
Try real hardware.
I am sorry, but, the code you posted does what it is intended to do.
In step 2 you set the port to b'00010000' then you rotate. If the sim does not work... then, real hardware will.
Let me show.... I have adapted your code adding some serial debug (which you can remove or use) and then I set portb to the value of porta when you initialise it....
Seems to work as expected. Something Bill Roth (a seasoned PIC developer) taught me... do not trust a simulator the real test is the real hardware.
But, I may be wrong but I think not.
Last edit: Anobium 2019-03-17
Yes, simulators are evil. Provoke stupid posts on the forum :) I Write a program, and the prototype is not ready yet, so I decided to use the simulator. He caused trouble. Once again, thank you very much for your response.
:-)
Advice. Do not use that old microcontroller - use a PIC16F18344 or something with more capabilities.
I have a lot of them, soldered from old devices. I make them animated snowflakes, so as not to throw. Their capabilities in this task is enough.
Excellent - re-use!
Do post completed project and a video when all done.
:-)
OK :-)