Triggering 5 TTL clocks simultaneously


Closed Thread
Results 1 to 40 of 84

Hybrid View

  1. #1
    TurboLS's Avatar
    TurboLS Guest


    Did you find this post helpful? Yes | No

    Default

    Also, I tried looking at the ADCON1 register, and i guess if I am reading from the table properly... to set PORTA.2 to digital in, I should say ADCON1 = %00001101 cuz that's where the D and the AN2 meet.

    I am still having a problem with the OnPushButton command and apparently I have to use END IF commands, which I am not sure how I will implement just yet.

  2. #2
    TurboLS's Avatar
    TurboLS Guest


    Did you find this post helpful? Yes | No

    Default

    I got it down to 6 errors, all with my IF statements. Here is what I have for a generic IF line:

    IF PushButtonOnPORTABIT2 = 1 THEN GOTO vertloop ELSE GOTO buttonloop

    on the following line i have

    ENDIF

    and doing that got rid of 3 of the errors, but now I need to figure out why it doesn't like my then goto / else goto commands.

    For each of my 3 if statements, I get

    bad expression
    bad expression or missing then
    Last edited by TurboLS; - 22nd February 2005 at 00:53.

  3. #3
    TurboLS's Avatar
    TurboLS Guest


    Did you find this post helpful? Yes | No

    Default

    OK, i know i have been posting a lot lately, but now i am down to 2 errors, both associated with

    IF PushButtonOnPORTABIT2 = 1 then

    I think it has something to do with me setting the ADCON1 register incorrectly.

  4. #4
    TurboLS's Avatar
    TurboLS Guest


    Did you find this post helpful? Yes | No

    Default

    OK, I fixed it (I think) to where I have no compiler errors.

    basically I had to change the above line to

    IF PORTA.2 = 1 then

  5. #5
    TurboLS's Avatar
    TurboLS Guest


    Did you find this post helpful? Yes | No

    Default

    So yeah I am still stuck with the whole reset clock thing. Is there a way I can generate a clock in hardware that is not a 50% duty cycle? By using one of the timer functions perhaps?

    I was also wondering approximately how fast each of the commands in my program would take to process. Knowing that, I would be able to generate the reset clock by estimating the time in usecs.

    thanks again for all the input.
    Last edited by TurboLS; - 22nd February 2005 at 04:37.

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    One thing i figure is to use the OSCLKO pin and connect to RB0 or else interrupt source. Once you'll be the in the interrupt routine, you'll be able to do everything. Generate all your delay and pin level. Will be a bit tricky to get the perfect timing but not impossible.

    If you want to generate a 4MHZ clock, you'll need a 8MHZ crystal. Interrupt on rising or falling edge. Interrupt routine will generate your R, H1 and H2 frequency in one shot.

    Depending your crystal speed, your instruction will be executed in few msec or less.

    BUT for that kind of stuff where accuracy and precision is important, you'll probably need to do your delay and some test in assembler. Assembler instruction can be executed in 1 or 2 frequency cyle. Let's say at 8MHZ, 1 intruction every (1/(8Mhz/4)) = 0.5 uSec. Can be usefull to have a PIC who have an internal PLL to multiply your cystal speed.

    If you have a 8MHZ crystal, execution time will be 4 times faster so from 0.5uSec to 0.125 uSec.
    Last edited by mister_e; - 22nd February 2005 at 04:49.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  7. #7
    TurboLS's Avatar
    TurboLS Guest


    Did you find this post helpful? Yes | No

    Default

    The reset, H2, and H1 will be about 3.6kHz. I don't know if there is a way I can get that with the multipliers.

    Is there like a table where I can calculate the execution times? I know that "time-sensitive" commands take 1 usec with a 20Mhz clock (which is what I am using).

    How long do if statements and such take, jumps to different parts of the program (like when I use the GOTO commands)?

Similar Threads

  1. PICs can do more if use others than delays instructions
    By hardcore in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 24th February 2010, 20:52
  2. How do I set GPIO 0-2 and 5 simultaneously?
    By cstack in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 19th August 2009, 10:32
  3. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 03:30
  4. Replies: 11
    Last Post: - 13th July 2005, 20:26

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts