Could I please ask for some help on my code


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    bit0 and bit1 are aliases to bits in the B0 byte variable

    So when you do something like ...
    Code:
    chk4: peek portA,B3
    if Bit1 = 0 then fire4
    goto chk4
    It will get locked in the loop forever, because Bit1 can never change.

    hth,
    DT

  2. #2
    Join Date
    Jun 2009
    Location
    Somerset England
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    Hi Darrel and thankyou very much for the reply.
    Can I ask Darrel how I should fix thiss problem,what should I type instead.
    Please forgive my uninformed aproach to all this but its all quite new to me and Ive only had myself as a teacher so there are some serious gaps for me,but I love it all the same.

    All the very best
    O.T.
    Last edited by opticaltrigger; - 20th January 2010 at 02:20.

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by opticaltrigger View Post
    Can I ask Darrel how I should fix thiss problem,what should I type instead.
    Well ... typing in your order for PicBasic Pro would probably be the easiest.

    But, in lieu of that ... put your values in B0 if you want to test the bits.

    Code:
    chk4: peek portA,B0
    if Bit1 = 0 then fire4
    goto chk4
    <br>
    DT

  4. #4
    Join Date
    Jun 2009
    Location
    Somerset England
    Posts
    10


    Did you find this post helpful? Yes | No

    Default thankyou Darrel

    Thanks very much Darrel for helping me with that.
    I just fired it up with the amended B0s and worked exactly as it should do straight away.I wish I could tell you how excited I feel seing it work.Its my first proper program for doing a job.
    If I lived closer I would buy you a beer Darrel.Thanks so much.

    Im going to swap the LEDs for transistors tomorow and see how it all gets on runing proper ignition coils and making sparks at the spark plugs.

    One last thing if I may.As said its my first proper program so I have no bench mark to go by in terms of its efficiency,and I noticed that you had mentioned BASIC PRO might be better.My question is does the code look ok or do you see a way it could be better,or perhaps is it as good as can be with ordinary BASIC?
    I want to try and get it to run as fast as possible really.
    Any comments would be great but once again thankyou very much for helping me with it Darrel.

    Best regards
    O.T.
    Last edited by opticaltrigger; - 20th January 2010 at 22:45.

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    And if we ever meet face to face, I will have you buy me that beer.

    Quote Originally Posted by opticaltrigger View Post
    Im going to swap the LEDs for transistors tomorow and see how it all gets on runing proper ignition coils and making sparks at the spark plugs.
    Well now that you put it that way ... That's the strangest distributor I've ever seen.

    One last thing if I may.As said its my first proper program so I have no bench mark to go by in terms of its efficiency,and I noticed that you had mentioned BASIC PRO might be better.My question is does the code look ok or do you see a way it could be better,or perhaps is it as good as can be with ordinary BASIC?
    When it comes to regular PicBasic ... If it does exactly what you wanted it to do, then it's the perfect program.

    You seem to be on the right track, so I'm sure you'll get the "Perfect" program for the next step too.

    Best regards,
    DT

  6. #6
    Join Date
    Jun 2009
    Location
    Somerset England
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    Well now that you put it that way ... That's the strangest distributor I've ever seen.


    Yeah,it does look kinda strange.
    I removed the rotor arm and put the segmented wheel in its place,the wheel itself is made from the cylinder head off a radio controled nitro car engine.

    Thanks again for your help with it.

    Best regards
    O.T.

  7. #7
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink

    Hi, OT

    I do not want to bash ...

    But using Pure Basic to trigger your coils did not need to have killed this poor engine head ... Generally speaking, only asm interrupts can do the job ...

    as your four cylinders ( do not joke ... it's not a flat 8 ??? ) distributor never will have enough accuracy in machining to give precise and separate advance values for the sparks ...

    I send you an example vor a V twin engine ( site has halas been modified ... no more download ! )

    Alain
    Attached Images Attached Images
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 21:55
  2. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. Re-Writing IF-THEN-AND-ENDIF code?
    By jessey in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 18th August 2006, 17:23

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