Loop 250 Khz

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
nycoly.bg
Posts: 4
Joined: Tue Mar 25, 2008 12:42 pm

Loop 250 Khz

Post by nycoly.bg »

Hello to all.
Some would have an example of as to generate 250Khz alternating.
Using PIC16F873A and Crystal 20Mhz And WatDog is Enable.
Only test.
Example:

Code: Select all

Loop: 
High PORTB.7 
Low PORTB.6
Low PORTB.7
PORTB.6 
Goto Loop

User avatar
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: Loop 250 Khz

Post by Benj »

Hello

You could use a C code block with the following code.

Code: Select all

while(1)
{
bit_set (portb, 7);
bit_clear(portb, 6);
bit_clear(portb, 7);
bit_set (portb, 6);
clear_wdt();
}

nycoly.bg
Posts: 4
Joined: Tue Mar 25, 2008 12:42 pm

Re: Loop 250 Khz

Post by nycoly.bg »

No works...

Iam don't understand definition fuses and configuration in FlowCode.
Using Menu - > Configuration ( Expert ) no define configuration also PicBasic

Proton PICBASIC Code... Works... 250Khz

Code: Select all

Device=16F873A
Declare XTAL=20
@CONFIG_REQ
@__CONFIG PWRTE_ON & WDT_ON & HS_OSC & LVP_OFF

TRISB = %00000000
freq:
    High    PORTB.7
    Low     PORTB.6
    
    Low     PORTB.7
    High    PORTB.6
GoTo freq

User avatar
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: Loop 250 Khz

Post by Benj »

Hello

The configuration screen in Flowcode replaces these line of code.

@CONFIG_REQ
@__CONFIG PWRTE_ON & WDT_ON & HS_OSC & LVP_OFF

So basically you want a HS oscillator mode with the Watchdog on and LVP off. Other settings are up to you.

nycoly.bg
Posts: 4
Joined: Tue Mar 25, 2008 12:42 pm

Re: Loop 250 Khz

Post by nycoly.bg »

Not meeting where to modify… you it would have an example?

User avatar
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: Loop 250 Khz

Post by Benj »

Hello

In the basic configuration screen you would want the Xtal mode and watchdog On.

In the advanced configuration you would want something similar to the following.

Osc - Hs
Watchdog - On
Power Up Timer - Off
Brown Out Detect - Off
Low Voltage Program - Off
Flash Write - Off
Background Debug - Disabled
Data EE Protect - Off
Code Protect - Off

Post Reply