Need assistance with code


Closed Thread
Results 1 to 3 of 3
  1. #1
    mrCizzo's Avatar
    mrCizzo Guest

    Default Need assistance with code

    I am trying to program a PIC16F887 to convert letters into the corresponding morse code and then output it through a speaker. The problem I am having is how to change the frequency of the output.

    I'm using assembly/machine language so it's a little rough in terms of trying to get any help with it. I would imagine it would have to be the OSCCON register but I can't seem to figure out how to make it output at 1kHz.

    Any help would be greatly appreciated.

  2. #2


    Did you find this post helpful? Yes | No

    Default

    The osccon register controls the frequency of the internal clock if you are using it. I am unfamiliar with assembly language but I think you simply need to use NOP commands/ pauses to correctly time how long a pin is on/off...

  3. #3
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    NOP = 1uS @ 4MHz

    Set pin High, add 500 NOP statements, Set pin Low, add 500 NOP Statements... repeat... suppose that's one way of outputting 1KHz...

    Do a forum SEARCH for Morse Code... I remember doing an example some time in pre-history...

    Ah... here it is...

    http://www.picbasic.co.uk/forum/show...31031#poststop

Similar Threads

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

Members who have read this thread : 1

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