Help converting small PicBasic program to MP LAB


Results 1 to 11 of 11

Threaded View

  1. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Help converting small PicBasic program to MP LAB

    What range of frequencies are you aiming to generate. I see from your SOUND statements that it would equal notes 50 to 113 but I don't know what that translates to in actual frequency (and are those numbers critical?

    Like Art says, all the SOUND command is doing is toggling a pin. You can do that too and you make the ADC do the conversion while waiting to flip the pin. Something like this perhaps (not tested):

    Code:
    SomeValue CON 250
    SomeConstant CON 4
    
    Main:
    IF Trigger THEN
      SPK = 1   ' Set pin high
    
      GO_DONE = 1
      WHILE GO_DONE : WEND   ' AD conversion will always take the same amount of time
      PAUSEUS SomeValue + (ADRES * SomeConstant)
    
      SPK = 0
    
      GO_DONE = 1
      WHILE GO_DONE : WEND   ' AD conversion will always take the same amount of time
      PAUSEUS SomeValue + (ADRES * SomeConstant)
    ENDIF
    Goto Main
    /Henrik.
    Last edited by HenrikOlsson; - 7th March 2017 at 19:35. Reason: ADRES was ADRESH

Similar Threads

  1. Multi servo interrupt program in Mikro Basic converting to PBP
    By queenidog in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 22nd May 2015, 17:17
  2. Converting CLEAR in Proton basic to picbasic pro
    By Nobby123 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 19th October 2013, 09:19
  3. help converting assembely program
    By ahmed_salah in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 7th August 2008, 15:28
  4. Making the Lab X1 communicate with the Lab X2
    By MatthewM in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 19th June 2008, 22:26
  5. 1st 16F877A program in PICBasic
    By Borisw37 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th January 2005, 04:46

Members who have read this thread : 0

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

Tags for this Thread

Posting Permissions

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