discrepancy in work Flowcode and a crystal
Moderator: Benj
- NOPROBLEM48
- Posts: 30
- Joined: Tue Nov 18, 2008 11:18 am
discrepancy in work Flowcode and a crystal
Hello, everyone!
Has found out discrepancy in work Flowcode and a crystal. On a crystal entrance level on port And while simulation is correct is not fixed. I think, here business in any peripheral functions of a crystal, but itself I can not understand in what.
Yours faithfully, Leonid.
Has found out discrepancy in work Flowcode and a crystal. On a crystal entrance level on port And while simulation is correct is not fixed. I think, here business in any peripheral functions of a crystal, but itself I can not understand in what.
Yours faithfully, Leonid.
- Attachments
-
- V1.fcf
- Attach
- (5 KiB) Downloaded 293 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: discrepancy in work Flowcode and a crystal
Hello
Your program is set to use a clock speed of 5MHz.
Your initial C code block writes 0xFF to the osccon register. I don't think this is correct.
Your chip configuration settings are set to use an external clock source.
Use the View -> Project options and set the correct crystal speed.
Look at the device datasheet and calculate the correct value for the osccon register.
Use the Chip -> Configuration menu to assign the internal oscillator to the device.
Your program is set to use a clock speed of 5MHz.
Your initial C code block writes 0xFF to the osccon register. I don't think this is correct.
Your chip configuration settings are set to use an external clock source.
Use the View -> Project options and set the correct crystal speed.
Look at the device datasheet and calculate the correct value for the osccon register.
Use the Chip -> Configuration menu to assign the internal oscillator to the device.
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
- NOPROBLEM48
- Posts: 30
- Joined: Tue Nov 18, 2008 11:18 am
Re: discrepancy in work Flowcode and a crystal
I am afraid, that your councils do not concern the given problem!
The crystal has clock speed 8 MHz as I and wanted, it is possible to be convinced of it, having looked work V2, here emulation Flowcode coincides with program work in a crystal. The problem being consists that program V1 is correctly emulated Flowcode but if it to program in a crystal change of a logic condition of port A is not perceived. I ask you to help to eliminate to me this discrepancy.
Yours faithfully, Leonid.
The crystal has clock speed 8 MHz as I and wanted, it is possible to be convinced of it, having looked work V2, here emulation Flowcode coincides with program work in a crystal. The problem being consists that program V1 is correctly emulated Flowcode but if it to program in a crystal change of a logic condition of port A is not perceived. I ask you to help to eliminate to me this discrepancy.
Yours faithfully, Leonid.
- Attachments
-
- V2.fcf
- (5 KiB) Downloaded 276 times
- NOPROBLEM48
- Posts: 30
- Joined: Tue Nov 18, 2008 11:18 am
Re: discrepancy in work Flowcode and a crystal
Has understood!
That the crystal worked how emulation Flowcode, it is necessary to disconnect inputs of converter A/D which coincide with A. For it it is necessary 0X0F to write down number in the register adcon1. It is made in program V3. It is correctly emulated Flowcode and works in a crystal.
Yours faithfully, Leonid.
That the crystal worked how emulation Flowcode, it is necessary to disconnect inputs of converter A/D which coincide with A. For it it is necessary 0X0F to write down number in the register adcon1. It is made in program V3. It is correctly emulated Flowcode and works in a crystal.
Yours faithfully, Leonid.
- Attachments
-
- V3.fcf
- (5.5 KiB) Downloaded 271 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: discrepancy in work Flowcode and a crystal
Hello Leonid
According to the device datasheet writing 0x0F to ADCON1 will convert the pins to analogue inputs.
If you look at the program C code then you have this.
According to the device datasheet writing 0x0F to ADCON1 will convert the pins to analogue inputs.
If you look at the program C code then you have this.
Code: Select all
void main()
{
//Initialisation
adcon1 = 0x00;
//C
//C Code:
osccon=0XFF;
adcon1=0X0F;
//Loop: While 1
while (1)
{
//Input: A0 -> Me
trisa = trisa | 0x01;
FCV_ME = ((porta & 0x01) == 0x01);
............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
- NOPROBLEM48
- Posts: 30
- Joined: Tue Nov 18, 2008 11:18 am
Re: discrepancy in work Flowcode and a crystal
Excellently!
At me too is such (DS39758C from 2007), but there absolutely another is written. And, the most interesting, my chip works how is written in mine datasheet.
Yours faithfully, Leonid.
At me too is such (DS39758C from 2007), but there absolutely another is written. And, the most interesting, my chip works how is written in mine datasheet.
Yours faithfully, Leonid.
- Attachments
-
- PDF.jpg
- (243.16 KiB) Downloaded 1370 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: discrepancy in work Flowcode and a crystal
Hi Lenoid
Hm so were both right and both wrong. Oh well I guess this chip must have been reversioned at some point.
If you like you can modify the initialiation line in the FCD file to match this alternate setting and this will allow you to create programs for your devices without having to add the line of C code at the start of your program.
Hm so were both right and both wrong. Oh well I guess this chip must have been reversioned at some point.
If you like you can modify the initialiation line in the FCD file to match this alternate setting and this will allow you to create programs for your devices without having to add the line of C code at the start of your program.
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
- NOPROBLEM48
- Posts: 30
- Joined: Tue Nov 18, 2008 11:18 am
Re: discrepancy in work Flowcode and a crystal
Thanks Benj!
You where in file 18F1330.fcd change to make could not prompt. I have seen it, but a place for this purpose have not found.
Yours faithfully, Leonid.
You where in file 18F1330.fcd change to make could not prompt. I have seen it, but a place for this purpose have not found.
Yours faithfully, Leonid.
- 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: discrepancy in work Flowcode and a crystal
Hello Lenoid
This is the line on the FCD file you are looking for, its in the
This is the line on the FCD file you are looking for, its in the
Code: Select all
section.
Initialise="adcon1 = 0x00;\n"
Change this to suit your chips.
Initialise="adcon1 = 0x0F;\n"
Then restart Flowcode and your chips will behaive correctly without needing to add the C code to the start of your program.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
- NOPROBLEM48
- Posts: 30
- Joined: Tue Nov 18, 2008 11:18 am
Re: discrepancy in work Flowcode and a crystal
Thanks Benj!
Independently I could not find this line.
Yours faithfully, Leonid.
Independently I could not find this line.
Yours faithfully, Leonid.