Hello,
I'm a new user of Flowcode.
PIC use : 16F877A. XTAL Frequency : 4MHz prescalaire to 16
I need to capture data bus on RB4 composed by word of 32 bits of 12.5Khz .Each Word are tranmit every 300ms.
But as i don't have any synchronisation or bit start and bit stop ,I use a second bus connected on RB0. 'Clock Word' (32bits of 12.5Khz) :
....................RBO (clock): ____--_--_--_--_--_--_____--_--_--_--_--_--_
Signal to capture : RB4 : _______--___--_--_--________--___--_--_--___
LCD Display : 0 1 0 1 1 1
I use timer0 ,set timer to 250 (255-250=5 , 5*16us = 80us => 12.5Khz) and after 32 loops ,i want to display the status of bus on LCD.
at each interruption i catch the state of RB4.
But it doesn't work ,someone can help me please ??
Here is my flowcode:
TIMER and PIC 16F877A
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Hello
Sounds like you may need a faster crystal. At the moment you only have 5 instructions between each sample. This means that the PIC will probably not be able to process the data quick enough as it comes in. Try using a 20MHz crystal and you should get better results.
Sounds like you may need a faster crystal. At the moment you only have 5 instructions between each sample. This means that the PIC will probably not be able to process the data quick enough as it comes in. Try using a 20MHz crystal and you should get better results.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
TIMER and PIC 16F877A
Thank you for you reply Benj,
I try to do the same program with 20MHz crystal,but it doesn't work .
I don't know why ;With 20MHz each instruction take 0.2us Right ?
For my capture, the delay between two bit is 80us ,So why PIC don't have enough time to execute a read of PORTB ,tranfert it in a text and a make a IF...THEN instruction during this time ?
May be I can take a new PIC like PIC18F4550 with 40MHz Quartz and test it again ?
what is do you about that ?
Mike
I try to do the same program with 20MHz crystal,but it doesn't work .
I don't know why ;With 20MHz each instruction take 0.2us Right ?
For my capture, the delay between two bit is 80us ,So why PIC don't have enough time to execute a read of PORTB ,tranfert it in a text and a make a IF...THEN instruction during this time ?
May be I can take a new PIC like PIC18F4550 with 40MHz Quartz and test it again ?
what is do you about that ?
Mike
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Hello Mike
Yes each instruction takes 0.2us at 20MHz.
there should be plenty of time (400 instruction cycles) for the PICmicro to complete its code between samples.
Reading a port is 1 instruction cycle, two if you are storing the value into a variable, three if you are using masking.
An IF or BRANCH statement is half an instruction cycle.
What do you mean by "transfer it in a text"
If you like you can send me your program and I will take a quick look to see if there are any obvious reasons for it not working.
Yes each instruction takes 0.2us at 20MHz.
there should be plenty of time (400 instruction cycles) for the PICmicro to complete its code between samples.
Reading a port is 1 instruction cycle, two if you are storing the value into a variable, three if you are using masking.
An IF or BRANCH statement is half an instruction cycle.
What do you mean by "transfer it in a text"
If you like you can send me your program and I will take a quick look to see if there are any obvious reasons for it not working.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Hello Mike
You can attach your program to an email.
My address is ben< at >matrixmultimedia.co.uk
We will have attachments for the forums as soon as the software reaches a stable version.
You can attach your program to an email.
My address is ben< at >matrixmultimedia.co.uk
We will have attachments for the forums as soon as the software reaches a stable version.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 8
- Joined: Mon Oct 11, 2010 4:58 pm
- Contact:
problem with the speed of 16F877A
Hello, I hope I can help.
Schedule a code in the Flowcode and works well in the simulator, also works well in the pic real simulator. But to take it to the real circuit does not work, starts to jump between screens and acts as if all the buttons will be activated at once.
I think the problem is how this set the speed, I have a 4 MHz crystal.
Where is the error or problem?
file attached to see
Claudio
Schedule a code in the Flowcode and works well in the simulator, also works well in the pic real simulator. But to take it to the real circuit does not work, starts to jump between screens and acts as if all the buttons will be activated at once.
I think the problem is how this set the speed, I have a 4 MHz crystal.
Where is the error or problem?
file attached to see
Claudio
- Attachments
-
- selector placa roja.fcf
- (35.69 KiB) Downloaded 443 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: TIMER and PIC 16F877A
Hello Claudio,
Could it be your circuitry? Are you allowing the input pins to float or are you always pulling them to ground or VDD using a resistor? A floating input pin will not read 0 and instead will give unpredictable readings. Please see the datasheet for our switch E-block and confirm you are wiring up the inputs as shown.
Could it be your circuitry? Are you allowing the input pins to float or are you always pulling them to ground or VDD using a resistor? A floating input pin will not read 0 and instead will give unpredictable readings. Please see the datasheet for our switch E-block and confirm you are wiring up the inputs as shown.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel