Help


Closed Thread
Results 1 to 5 of 5

Thread: Help

  1. #1
    Join Date
    Apr 2007
    Posts
    5

    Default Help

    I am currently doing a voiced controlled robot (as instructed by the book "PIC Robotics" by John Iovine) that requires the use of a PIC16F84 microcontroller to decode the output of the speech recognition chip HM2007.

    I got the following programming code from that book.

    --------------------------------------------------------------------------
    'Speech recognition interface program
    symbol porta = 5
    symbol trisa = 133
    symbol portb = 6
    symbol trisb = 134
    poke trisa, 255
    poke trisb, 240
    start:
    peek portb, b0
    if bit4 = 0 then trigger 'Trigger enabled, read speech recognition circuit
    goto start 'Repeat
    trigger:
    pause 500 'Wait .5 second
    peek portb, b0 'Read bcd number
    if bit5 = 1 then send 'Output number
    goto start 'Repeat
    send:
    peek porta, b0 'Read port a
    if bit4 = 1 then eleven 'Is the number 11
    poke portb, b0 'Output number
    goto start 'Repeat
    eleven:
    if bit0 = 0 then ten
    poke portb, 11
    goto start 'Repeat
    ten:
    poke portb, 10
    goto start 'Repeat
    end
    --------------------------------------------------------------------------

    After I installed PicBasic Pro Compiler Demo and chose the targer processor to 16F84, I got 21 errors in the above programming code. What is wrong? Is the book wrong?

    I am new to programming and microcontroller so please help! (with plain english of course as I am not very familiar with this kind of stuff^_^)

    Also can I use "Programming Editor for PICAXE" to load the program into PIC16F84 chip? Or do I have to use ProBasic for PIC16F84?
    Last edited by cyh_fax; - 18th April 2007 at 02:49.

  2. #2
    Join Date
    Apr 2006
    Location
    Alberta Canada
    Posts
    166


    Did you find this post helpful? Yes | No

    Default

    that code is only part of what you need, it would be the part to interface with the voice chip. you would still need to write the rest of the code such as variables and your outputs..

  3. #3
    Join Date
    Apr 2007
    Posts
    5


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by dragons_fire View Post
    that code is only part of what you need, it would be the part to interface with the voice chip. you would still need to write the rest of the code such as variables and your outputs..
    But so far is there any problem in the code? It won't compile though, keeping saying there is syntax error, for example in line 1 symbol....

    Also, PIC16F84 just detect whether the input BCD signal from Hm2007 is 55,66,77 error code, if not, it will pass the input to output unchanged and let the 74HC154 to do the decoding. This is what the book says. Please help, I am so lost now.

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by cyh_fax View Post
    But so far is there any problem in the code? It won't compile though, keeping saying there is syntax error, for example in line 1 symbol....

    Also, PIC16F84 just detect whether the input BCD signal from Hm2007 is 55,66,77 error code, if not, it will pass the input to output unchanged and let the 74HC154 to do the decoding. This is what the book says. Please help, I am so lost now.
    Check the manual about your paths and how you should be installing the software.

  5. #5
    Join Date
    Apr 2007
    Posts
    5


    Did you find this post helpful? Yes | No

    Default

    I have converted the original code into PicBasic Pro format and also extended the code to accept 0-15 output. [The original one only accept from 0-11] Can anyone check the code for me? Is it correct?

    'Speech Recognition Interface - PIC16F84A
    'PicBasic Pro
    'Version 1.3

    trisa = 255
    trisb = 240
    p var byte

    start:
    p = portb
    if p.4 = 1 then goto start
    pause 500
    p = portb
    if p.5 = 1 then send
    goto start

    send:
    p = porta
    if p.4 = 1 then odd
    portb = p
    goto start

    odd:
    if p.0 = 0 then even
    if (p.1 = 0) and (p.2 = 0) and (p.3 = 0) then portb = 11
    if (p.1 = 1) and (p.2 = 0) then portb = 13
    if (p.1 = 0) and (p.2 = 1) then portb = 15
    if (p.1 = 1) and (p.2 = 1) then portb = 15 '17 originally.
    if p.3 = 1 then portb = 15 '19 originally.
    goto start

    even:
    if (p.1 = 0) and (p.2 = 0) and (p.3 = 0) then portb = 10
    if (p.1 = 1) and (p.2 = 0) then portb = 12
    if (p.1 = 0) and (p.2 = 1) then portb = 14
    if (p.1 = 1) and (p.2 = 1) then portb = 15 '16 originally.
    if p.3 = 1 then portb = 15 '18 originally.
    goto start

    end

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