Shop OBEX P1 Docs P2 Docs Learn Events
MP3 PLAYER using basic stamp 2 - Page 4 — Parallax Forums

MP3 PLAYER using basic stamp 2

124»

Comments

  • kwinnkwinn Posts: 8,697
    Is the BASIC STAMP going to receive the entire schedule and use that to tell the CY what file to play at the scheduled time, or is it going to be told to play a specific file at the scheduled time? In other words is the scheduling done by the BASIC STAMP or by an external system?
  • GenetixGenetix Posts: 1,742
    edited 2016-07-09 09:56
    cydelcamat,

    You can access any EEPROM memory location with the READ and WRITE directive but be careful that you don't overwrite your program.

    There is also the DATA directive which stores data in the EEPROM and then your program uses the READ command to retrieve it.
    You could store groups of CY-T16 commands as DATA and then READ them before using the SEROUT command.

    What's a Microcontroller (WAM) teaches how to use DATA, READ, and WRITE.
  • Excuse me for cutting in, does anyone know why cydelcamat's post counter isn't working, he started this thread at post #47, and over two dozen posts later, it's still 47.

    Just curious.
  • cydelcamatcydelcamat Posts: 53
    edited 2016-07-16 00:10
    Hi guys im back again. this are my codes for playing the mp3 module by using VB program. the commands we used is play, pause, previous and next. our next step is to create a schedule for alarms and store it to basic stamp. does anyone here has an experience on doing that? thanks!!!!

    main:

    SERIN 16, 84, [cmd_buff]

    IF cmd_buff = "A" THEN
    SEROUT 14, T9600, [$7E, $FF, $06, $11, $00, $00, $01, $FE, $E9, $EF]
    ELSEIF cmd_buff = "a" THEN
    SEROUT 14, T9600, [$7E, $FF, $06, $0E, $00, $00, $00, $FE, $ED, $EF]
    ENDIF

    IF cmd_buff = "B" THEN
    SEROUT 14, T9600, [$7E, $FF, $06, $01, $00, $00, $00, $FE, $FA, $EF]
    ELSEIF cmd_buff = "b" THEN
    SEROUT 14, T9600, [$7E, $FF, $06, $02, $00, $00, $00, $FE, $F9, $EF]
    ENDIF

    GOTO main

  • cydelcamat,

    Your code should look like this:
    DO
    
      SERIN 16, 84, [cmd_buff]
    
      IF (cmd_buff = "A") THEN
        SEROUT 14, T9600, [$7E, $FF, $06, $11, $00, $00, $01, $FE, $E9, $EF]
      ELSEIF (cmd_buff = "a") THEN
        SEROUT 14, T9600, [$7E, $FF, $06, $0E, $00, $00, $00, $FE, $ED, $EF]
      ENDIF
    
      IF (cmd_buff = "B") THEN
        SEROUT 14, T9600, [$7E, $FF, $06, $01, $00, $00, $00, $FE, $FA, $EF]
      ELSEIF (cmd_buff = "b") THEN
        SEROUT 14, T9600, [$7E, $FF, $06, $02, $00, $00, $00, $FE, $F9, $EF]
      ENDIF
    
    LOOP
    


    You were asked this before but never answered.
    Is the schedule a part of the BS2 program or does the schedule get sent to the BS2?

    If it's part of the program then you store it in DATA statements and retrieve it using the READ command.
    You can find examples of both in What's a Microcontroller and The BASIC Stamp Manual.
  • kwinnkwinn Posts: 8,697
    cydelcamat wrote: »
    Hi guys im back again. this are my codes for playing the mp3 module by using VB program. the commands we used is play, pause, previous and next. our next step is to create a schedule for alarms and store it to basic stamp. does anyone here has an experience on doing that? thanks!!!!

    Best way of doing that depends on the GPS time format and how many commands are needed for each event. Most of my schedules use the "@" to specify the time, followed by the time of day in minutes, followed by the commands needed for that event.

    How many commands need to be sent to the CY for each event?
  • Hi guys sorry for the late reply. The basic stamp will store the schedules sent from vb program. How can we send and store schedule from vb program to basic stamp 2? THANKS!
  • cydelcamat,

    What does the schedule look like and how often does it change?

    The schedule can be stored in the EEPROM using the WRITE command and then retrieved as needed using the READ command.
  • kwinnkwinn Posts: 8,697
    cydelcamat wrote: »
    Hi guys sorry for the late reply. The basic stamp will store the schedules sent from vb program. How can we send and store schedule from vb program to basic stamp 2? THANKS!

    Essentially you will need to store a list of the times an event is to happen and the command (or multiple commands) that need to be sent to the CY. My initial thought would be a simple list of the commands with required parameters such as the following:
    $40 09:00      ' time command (@ 09:00)
    $03 $00 $0007   ' CY command and parameter (play track 7)
    $40 10:30    ' at 10:30
    $03 $00 $0009   ' play track 9
    

    The time command byte could be any 8 bit value. I generally use the @ ($40) character. The time itself could be stored in the same format as the gps data for ease of comparison.

    Since the first 3 bytes and the last byte of the commands are always the same, and the checksum is calculated, you only need to store the command, feedback, and parameter 1 & 2 in the table.
  • I`ve attach a print screen of our existing vb program which gives(export and synchronize) schedule to our currently using PIC. Now my problem is how can i store schedule on basic stamp`s eeprom. all tutorial i see about read and write is how to put decimal to specific address of eeprom. Can you guys help me how can i put the schedule(time) in eeprom. TIA guys.
    718 x 557 - 179K
  • kwinn wrote: »
    cydelcamat wrote: »
    Hi guys sorry for the late reply. The basic stamp will store the schedules sent from vb program. How can we send and store schedule from vb program to basic stamp 2? THANKS!

    Essentially you will need to store a list of the times an event is to happen and the command (or multiple commands) that need to be sent to the CY. My initial thought would be a simple list of the commands with required parameters such as the following:
    $40 09:00      ' time command (@ 09:00)
    $03 $00 $0007   ' CY command and parameter (play track 7)
    $40 10:30    ' at 10:30
    $03 $00 $0009   ' play track 9
    

    The time command byte could be any 8 bit value. I generally use the @ ($40) character. The time itself could be stored in the same format as the gps data for ease of comparison.

    Since the first 3 bytes and the last byte of the commands are always the same, and the checksum is calculated, you only need to store the command, feedback, and parameter 1 & 2 in the table.

    Sir Kwinn, can u give me a differ explanation? Sorry that u cant understand your first explanation, TIA :)
  • kwinnkwinn Posts: 8,697
    cydelcamat wrote: »
    kwinn wrote: »
    cydelcamat wrote: »
    Hi guys sorry for the late reply. The basic stamp will store the schedules sent from vb program. How can we send and store schedule from vb program to basic stamp 2? THANKS!

    Essentially you will need to store a list of the times an event is to happen and the command (or multiple commands) that need to be sent to the CY. My initial thought would be a simple list of the commands with required parameters such as the following:
    $40 09:00      ' time command (@ 09:00)
    $03 $00 $0007   ' CY command and parameter (play track 7)
    $40 10:30    ' at 10:30
    $03 $00 $0009   ' play track 9
    

    The time command byte could be any 8 bit value. I generally use the @ ($40) character. The time itself could be stored in the same format as the gps data for ease of comparison.

    Since the first 3 bytes and the last byte of the commands are always the same, and the checksum is calculated, you only need to store the command, feedback, and parameter 1 & 2 in the table.

    Sir Kwinn, can u give me a differ explanation? Sorry that u cant understand your first explanation, TIA :)

    I will try to explain better once I understand what you need to do better than I do now.

    That screen shot helps a little, but what we really need to see is the actual data that is being sent to the PIC by the VB program for a few of the events. That data has to be stored by the BS2 in a format it can use to send the appropriate commands to the CY chip.
  • kwinn wrote: »
    cydelcamat wrote: »
    kwinn wrote: »
    cydelcamat wrote: »
    Hi guys sorry for the late reply. The basic stamp will store the schedules sent from vb program. How can we send and store schedule from vb program to basic stamp 2? THANKS!

    Essentially you will need to store a list of the times an event is to happen and the command (or multiple commands) that need to be sent to the CY. My initial thought would be a simple list of the commands with required parameters such as the following:
    $40 09:00      ' time command (@ 09:00)
    $03 $00 $0007   ' CY command and parameter (play track 7)
    $40 10:30    ' at 10:30
    $03 $00 $0009   ' play track 9
    

    The time command byte could be any 8 bit value. I generally use the @ ($40) character. The time itself could be stored in the same format as the gps data for ease of comparison.

    Since the first 3 bytes and the last byte of the commands are always the same, and the checksum is calculated, you only need to store the command, feedback, and parameter 1 & 2 in the table.

    Sir Kwinn, can u give me a differ explanation? Sorry that u cant understand your first explanation, TIA :)

    I will try to explain better once I understand what you need to do better than I do now.

    That screen shot helps a little, but what we really need to see is the actual data that is being sent to the PIC by the VB program for a few of the events. That data has to be stored by the BS2 in a format it can use to send the appropriate commands to the CY chip.

    Sir Kwinn. Just give us a short example of how store time in eeprom. thats all i want to know because. all i see examples on how to read and write eeprom is just decimals to specific address of eeprom. If u know can u teach me?. needed badly.
  • kwinnkwinn Posts: 8,697
    Data is stored to eeprom as bytes, so you would store the times and the CY commands as a string of bytes. These command bytes would have to be received from the VB software and written to the eeprom using the WRITE command.

    Time can be stored in several formats. The simplest would be to store it as 4 ascii characters (hh mm) which can be compared directly to the ascii characters from the gps units.
    Another option would be to store it as 2 bytes of binary or hex data. More compact but more work to compare to the gps data.

    The best choice depends on the format of the incoming VB and GPS data, so it is important to have that information.
  • kwinn wrote: »
    Data is stored to eeprom as bytes, so you would store the times and the CY commands as a string of bytes. These command bytes would have to be received from the VB software and written to the eeprom using the WRITE command.

    Time can be stored in several formats. The simplest would be to store it as 4 ascii characters (hh mm) which can be compared directly to the ascii characters from the gps units.
    Another option would be to store it as 2 bytes of binary or hex data. More compact but more work to compare to the gps data.

    The best choice depends on the format of the incoming VB and GPS data, so it is important to have that information.

    oh i get it. thanks i`ll give it a try to do it :)
Sign In or Register to comment.