Shop OBEX P1 Docs P2 Docs Learn Events
Emic2 & PICAXE — Parallax Forums

Emic2 & PICAXE

wperkowperko Posts: 66
edited 2014-08-19 06:35 in General Discussion
Can somebody tell me why this program is not working?

I don't seem to be getting a ":" back from the Emic2 nor does it speak anything.

If I plug it into a BOE the Emic2 works perfectly ... so it must be

; Emic2&PICAXE

#picaxe 28X2 ; Define the µProcessor IC Type

hsersetup B9600_32, %10 ; 9600 baud, inverted polarity

symbol Ready = b0

; BEGIN Main Body * * * * * * * * * * * * * * * * * * * * *
main:
pause 5000

do
gosub speak1
loop
end
; END Main Body * * * * * * * * * * * * * * * * * * * * **

; BEGIN Subroutines * * * * * * * * * * * * * * * * * * **
ReadyChk:
hserin 0,Ready
debug b0
if Ready <> ":" then return ; Waiting for the Emic2 to send its ":" character as being READY
endif
return

speak1:
hserout 0,("S", "Hello")
gosub ReadyChk
hserout 0,("S", "My name is the Emic 2")
gosub ReadyChk
return
end
; END Subroutines * * * * * * * * * * * * * * * * * * * **

Comments

  • AGCBAGCB Posts: 327
    edited 2014-08-17 11:37
    I've found that I need to first send the command "S" as a text byte before sending the string on different lines
    then this
    ser.TX(pst#NL)
      repeat until ser.RxCheck == ":"
    

    Not all my work, I got hints off the OBEX (actually a lot more than hints)

    Aaron
  • wperkowperko Posts: 66
    edited 2014-08-17 12:45
    AGCB wrote: »
    I've found that I need to first send the command "S" as a text byte before sending the string on different lines
    then this
    ser.TX(pst#NL)
      repeat until ser.RxCheck == ":"
    

    Not all my work, I got hints off the OBEX (actually a lot more than hints)

    Aaron

    Hi,

    IF U read the code I posted you can see I am sending an "S" before the text ... Just as the manual prescribes.

    That's not an hserout or hserin command ??? totally useless solution for my PICAXE chip.

    I'm looking for a solution not a WAG.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2014-08-17 13:53
    I'm looking for a solution not a WAG.
    Being rude on the forums will not get you what you need, that's a certainty.
  • ercoerco Posts: 20,256
    edited 2014-08-17 15:33
    Your Emic works with Boebot, so your problem is Picaxe-related. Likely something with baud rate, inverted or hserout. Ask your question in the Picaxe forum.

    http://www.picaxeforum.co.uk/forumdisplay.php?2-Active-PICAXE-Forum
  • wperkowperko Posts: 66
    edited 2014-08-17 20:09
    erco wrote: »
    Your Emic works with Boebot, so your problem is Picaxe-related. Likely something with baud rate, inverted or hserout. Ask your question in the Picaxe forum.

    http://www.picaxeforum.co.uk/forumdisplay.php?2-Active-PICAXE-Forum


    Hi,

    You are assuming that people that use a PICAXE µController do not buy Parallax peripheral components and that PICAXE users do not use the forum here ???

    True it is will be a simple PICAXE BASIC solution, but I'm asking in both forums for help. There are intelligent people in both forums so this increases my chances of a solution despite non-solution suggestions by people that do not know the answer to the original question.
  • ercoerco Posts: 20,256
    edited 2014-08-17 21:31
    We (NWCCTV and I) don't get your hostility and defensiveness when all people are trying to do is help you in a timely manner, wperko.

    I see you posted your PicAxe question in the PicAxe forum. Best of luck with your project.
  • wperkowperko Posts: 66
    edited 2014-08-17 21:42
    erco wrote: »
    We (NWCCTV and I) don't get your hostility and defensiveness when all people are trying to do is help you in a timely manner, wperko.

    I see you posted your PicAxe question in the PicAxe forum. Best of luck with your project.

    Hi,

    It's a PICAXE question about a Parallax component.

    The forum is for people to look for answers from friendly helpers not criticism about their questions or calling them rude. What is rude is you posting on other ideas other than a solution to the original question.
  • AGCBAGCB Posts: 327
    edited 2014-08-18 04:39
    Please take this as a friendly, helpful post

    I do not know the language of PICAXE but this is a program in Propeller Spin that works. Much of the code came from Joe Grand, the designer of the EMIC 2. As you can see the command to the EMIC is sent as a text byte prior to the string being sent. I also tried to put the command in the same line IE (sText) but could not get it to work. Upon studying Spin objects I found the separate line way and it works.

    If you don't get the info you need in the PICAXE language, you may have to convert the Spin for your mC and figure it out.

    Aaron
    CON   { uses EMIC 2 to say temperature read from TC74  No extra COGs used for EMIC
                    a few laughs added for demo purposes
                    Much code comes from objects by Joe Grand and Rogersyd
                    See below for TERMS OF USE
                    }
    
      _clkmode = xtal1 + pll16x      '80 MHz system clock
      _xinfreq = 5_000_000
      
      EMIC_TX  = 6   'serial output (connects to Emic 2 SIN)
      EMIC_RX  = 7   'serial input  (connects to Emic 2 SOUT) [use 10k series resistor]
    
      SDA_pin  = 21         'for TC74
      SCL_pin  = 20
      Bitrate  = 100_000   
      
    VAR
      word kelvin   
      byte temper,F   'storage for I2C read and value converted to fahrenheit
      
    OBJ
      pst    : "Parallax serial Terminal"                   ' Debug Terminal
      fds    : "FullDuplexserial"                           
      I2C    : "I2C PASM driver v1.3"
        
    PUB  init   'start objects 
      I2C.start(SCL_pin,SDA_pin,bitrate)
      fds.start(7,6,0,9600)
      pst.start(9600)      'no pst display in this program except parser change and ":"s (ready)
      main
    
    PUB  Main    'NOTE  there are grammer and spelling mods to make speach sound better
                            ' and more that could be made (I'm trying to learn DECtalk)
      'repeat 2      
      temper:=(I2C.read(I2C#TC74,00))  'get temperature from TC74  
      F:= temper*9/5+32     'convert to fahrenheit
    
      pst.Str(String("changing to DECtalk parser"))  ' also works same w/ Epson parser
      fds.TX("P")    'send command for parser change
      fds.dec(0)     'select DECtalk
      fds.TX(pst#NL)     'this line and the next needed for EMIC 2 operation
      repeat until fds.RxCheck == ":"
      pst.Str(String(13,":"))
       
      fds.tx("S")    'send command for speach
      fds.Str(string("the temperature is"))                              
      fds.dec(F)     'say the variable 
      fds.str(string("degrees faran heit."))
      fds.TX(pst#NL)
      repeat until fds.RxCheck == ":"         
      waitcnt(clkfreq*3+cnt) 'repeat every 3 second  (if repeat loop)
    
             
      temper:=(I2C.read(I2C#TC74,00))    
      F:= temper*9/5+32     'convert to fahrenheit
      kelvin:=temper+273    'convert to kelvin
      
      fds.tx("S")
      fds.Str(string("the temperature is"))                              
      fds.dec(F)
      fds.str(string("degrees faran heit"))
      fds.dec(temper)    'say temperture in celcius
      fds.str(string("degrees centigrade, and"))
      fds.dec(kelvin)    'say temperture in kelvin
      fds.str(string("degrees kelvin."))
      fds.TX(pst#NL)
      repeat until fds.RxCheck == ":"
      waitcnt(clkfreq+cnt)
               
      fds.tx("S")
      fds.str(string("I'm pretty smart, ain't I? By the way, who, is, Kelvin."))
      fds.TX(pst#NL)
      repeat until fds.RxCheck == ":"
      waitcnt(clkfreq+cnt)
      
      fds.tx("S")
      fds.str(String(" I'm also getting hungry from all this calculation work."))
      fds.TX(pst#NL)
      repeat until fds.RxCheck == ":"
      
      fds.tx("S")
      fds.str(string(" What, do you have, to eete, in this place. If you need sugestions, I have some."))
      fds.TX(pst#NL)
      repeat until fds.RxCheck == ":"
      waitcnt(clkfreq+cnt)
      
      fds.tx("S")
      waitcnt(clkfreq+cnt)
      Fds.str(string("A juicy steak, and ice cream for dessert, would be nice."))
      fds.TX(pst#NL)
      repeat until fds.RxCheck == ":"
      
      fds.tx("S")
      fds.str(string("I'll let you know, when I'm ready, to go back to work. Do not bauther me, in the mean time."))
      fds.TX(pst#NL)
      repeat until fds.RxCheck == ":"
      
    DAT  
    {{
    
    &#9484;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9488;
    &#9474;                                                   TERMS OF USE: MIT License                                                  &#9474;                                                            
    &#9500;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9508;
    &#9474;Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation    &#9474; 
    &#9474;files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,    &#9474;
    &#9474;modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software&#9474;
    &#9474;is furnished to do so, subject to the following conditions:                                                                   &#9474;
    &#9474;                                                                                                                              &#9474;
    &#9474;The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.&#9474;
    &#9474;                                                                                                                              &#9474;
    &#9474;THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE          &#9474;
    &#9474;WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR         &#9474;
    &#9474;COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,   &#9474;
    &#9474;ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                         &#9474;
    &#9492;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9496;
    }}
    
  • ercoerco Posts: 20,256
    edited 2014-08-18 07:48
    Aaron: You're a good man for continuing to try to help. FYI, the Picaxe moderators pointed out three errors in Walt's program.

    http://www.picaxeforum.co.uk/showthread.php?26333-Emic2-amp-PICAXE&p=269064#post269064
  • wperkowperko Posts: 66
    edited 2014-08-19 05:36
    Hi,

    The program is working except that the Emic2 seems to only return a character 13 (=cr) instead of a : (=58) ??? No matter how fast or how slow I watch the 9600 BAUD serial IN port I never see the 58 character :

    I've tried having Emic2 speak very short messages and very long messages (D1) which is about 31-seconds long ... but I still cannot seem to get a 58 character.
  • PublisonPublison Posts: 12,366
    edited 2014-08-19 05:48
    erco wrote: »
    Aaron: You're a good man for continuing to try to help. FYI, the Picaxe moderators pointed out three errors in Walt's program.

    http://www.picaxeforum.co.uk/showthread.php?26333-Emic2-amp-PICAXE&p=269064#post269064

    I wonder if that "hippy" is on in the same as our"Hippy" ?
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2014-08-19 05:56
    Publison wrote: »
    I wonder if that "hippy" is on in the same as our"Hippy" ?

    Pretty sure it is based on posts I've seen from him before...
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2014-08-19 06:10
    wperko wrote: »
    ... but I still cannot seem to get a 58 character.

    Don't know why - all of the SPIN code programs I've seen have do this after sending data
    repeat until serial.RxCheck == ":"
    
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2014-08-19 06:35
    BTW, there is a web site that has DECTALK songs which can be tweaked for the EMIC2 http://www.theflameofhope.co/SONGS.html

    Here is an mp3 of Edelweis and the EMIC input is attached

    http://ronczap.home.insightbb.com/EDELWEIS.mp3
Sign In or Register to comment.