newbie Q - edge detection?


Closed Thread
Results 1 to 16 of 16

Hybrid View

  1. #1
    RMCRAVEN's Avatar
    RMCRAVEN Guest


    Did you find this post helpful? Yes | No

    Default

    Many thanks for the efforts you have all put into explaining things for me. Some of it has helped and I feel that I have grasped a tiny bit of programming mentality.

    I have now spent the last 5 or so days working through some of the PBP examples. I've also been working through an online ASM course so as to try to grasp some of the background to the PIC16F62X datasheet, which I have also been trying to absorb parts of.

    To be blunt, it isn't sinking in. I fear that it's likely to be beyond me (again - just like 6502 was 20 years ago when I did my college work, , and just like C was 5 years ago when I went on a 1 week beginner's course).

    The frustrating thing is this: I think I have identified that what I want to do is almost trivial!

    Please have a look at my plan if you have a few moments:

    1) detect a rising edge on an input clock signal, frequencies f <= 100Hz - use portB.0 interrupt

    2) Use that as a trigger to generate f/2, f/3, f/4... f/8 from remaining port B output pins
    and/or
    3)provide portA.0 "f/n" output where n is derived from a 4 bit switch on port A1..4 - some kind of binary or decade counter type approach I suppose.

    4) Every time that rising edge occurs on PortB.0, transmit 0xF8 serial out of the USART (MIDI clock @ 21.25 kbps)

    5) Detect two other pins' (e.g. A.5 and A.6 ) rising edges and transmit other words (0xFA or 0xF0) out of the USART. This could be done by ANDing with B.0 I suppose.

    I'm hoping to use a PIC16F628 seeing as it has the hardware USART I think I need. I have someone else's assembler code which is used for the other part of the project,namely to read a MIDI data stream and provide TTL pulses when certain MIDI events occur (start/stop/continue and clock)

    Am I right in my assertion that all of this is easily within the capability of a 20MHz MCU?

    Cheers

    RMC

  2. #2
    Join Date
    Nov 2004
    Location
    Saskatchewan Canada
    Posts
    189


    Did you find this post helpful? Yes | No

    Default

    I can sympathize with some of the learning curve. I took BASIC in school 20+ years ago on an OS/2 machine. That machine that weighed 50 pounds probably didn't pack half the power of even the most basic PIC today which I still find amazing. It was the most basic of BASIC you could say and back then I had a hard time even grasping that - and loops were totally alien as I didn't "get" those at all.

    In short, like you RMC, this programming thing didn't make any sense. But I kept at it and then one day it fell into place and I was able to get through that part of the class easily.

    PBP was a whole new ball game again, but by then I had learned a bit more of the basic language even though it was still 20 years ago that I had touched it, so the learning curve was not as bad. PBP still packed in all sorts of new commands that I had never heard of before and still take some time to grasp.

    I'm by no means an expert and I still classify myself as a newbie, but I want to assure you that if you work at it you can learn and the "basics" will fall into place and seem very easy. Just by reading this board I've been learning more and more and so can you, just don't give up and don't be afraid to ask questions!

    Bart

  3. #3
    RMCRAVEN's Avatar
    RMCRAVEN Guest


    Did you find this post helpful? Yes | No

    Default

    @bartman and all

    thanks for your encouragement. I think I am trying to run before I can walk so if I aim my sights a little lower, perhaps my frustration will diminisha dn I'll start absorbing the information!

    I'm going to continue with PBP and also continue with my initial exploration into assembler. I'm hoping the two will to some extent compliment one another.

    I'll keep reading!

    Thanks for the encouragment

    RMC, England

  4. #4
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

    Default

    Personally I taught myself picbasic so I could avoid learning assembly. While assembly can get you out of trouble from time to time, I don't know that having an understanding of it would help.

    I would concentrate your efforts for now mastering picbasic. The key when your learning is break a program down to smaller parts and get the small parts working. So if you have an LCD get a "hello world" before continuing.

    However be ready for those smaller parts to "break" when you start merging them. You'll do fine! Read posts and ask specific questions, you will get there.

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,177


    Did you find this post helpful? Yes | No

    Default

    If your code is not working, post here for us to have a look.

    Also if you are going to use Interrupts, then in your case, you should use PortB, bits from 4 to 7, because these have an interrupt on change feature.

    Ioannis

Similar Threads

  1. mS Timer
    By whmeade10 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th September 2020, 12:12
  2. Newbie making an ignition timer
    By ChrisHelvey in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 5th August 2012, 17:45
  3. RC Servo decoding/encoding using 12F683
    By ScaleRobotics in forum Code Examples
    Replies: 13
    Last Post: - 14th September 2010, 00:49
  4. Phase failure detection
    By ardhuru in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 9th January 2007, 00:53
  5. Auto Baud Rate Detection
    By mytekcontrols in forum Serial
    Replies: 10
    Last Post: - 31st October 2005, 02:17

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