-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b5554f5
Showing
27 changed files
with
5,202 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
*.asm | ||
*.cod | ||
*.bak | ||
*.*~ | ||
*.orig | ||
*.sjis | ||
*.led | ||
tags | ||
*.dat | ||
log.* | ||
*.xml | ||
*.xml.* | ||
*.lck | ||
device_select.jal | ||
*.out | ||
*.db | ||
*.log | ||
*.eemap | ||
*.pmp | ||
*.tree | ||
*.ods | ||
movlp* | ||
pwm-period* | ||
|
||
Backup/ | ||
build/ | ||
1.3/ | ||
1.4/ | ||
hex/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Copyright (c) 2017, avrin (http://mpu.seesaa.net/article/445037481.html) | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | ||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
# | ||
# Makefile script | ||
# For jalv2 Compiler | ||
# avrin, Copyright (c) 2012, 2016, 2017, 2021 all rights reserved. | ||
# 2016/12 Modified for SD card wav player | ||
# 2012/01 Created by avrin. | ||
# This program is released under the BSD license. | ||
# | ||
|
||
#device = 12F1840 | ||
#device = 16F1455 | ||
#device = 16F1459 | ||
#device = 16F1619 | ||
#device = 16F1705 | ||
#device = 16F1709 | ||
#device = 16F1764 | ||
#device = 16F18313 | ||
#device = 16F18325 | ||
#device = 16F1825 | ||
device = 16F1827 | ||
#device = 16F1829 | ||
#device = 16F88 | ||
#device = 16F1938 | ||
#device = 18F13K50 | ||
#device = 18F14K50 | ||
#device = 18F26J50 | ||
|
||
rm = rm -fr | ||
# for windows | ||
#rm = del /s /q /f | ||
|
||
|
||
main_name = main | ||
main_file = $(main_name).jal | ||
target = sd-wav-player-$(device) | ||
jal_root = d:/0pic-data/jalv2-data | ||
|
||
jal_sys = $(jal_root)/jallib_full-1.6.0 | ||
|
||
jal_cc = $(jal_sys)/Compiler/jalv2.exe | ||
jallib_dir = $(jal_sys)/lib | ||
|
||
#asm_list = -asm $(target).asm #-codfile $(target).cod | ||
#noreuse = -no-variable-reuse | ||
fastmath = -fastmath | ||
jal_flags += $(incs) | ||
jal_flags += -temp-reduce | ||
jal_flags += $(noreuse) | ||
jal_flags += $(asm_list) | ||
jal_flags += $(fastmath) | ||
|
||
incs = -s $(jallib_dir) -s lib -s debug | ||
depends = config_def.jal \ | ||
port_def.jal \ | ||
wave_player_main.jal \ | ||
\ | ||
lib/fat_lib.jal \ | ||
lib/power_off_mode.jal \ | ||
lib/pwm_lib.jal \ | ||
lib/register_def.jal \ | ||
lib/sd_card_local.jal \ | ||
lib/timers.jal \ | ||
\ | ||
debug/debug_info1.jal \ | ||
debug/debug_info2.jal \ | ||
debug/debug_tool.jal \ | ||
\ | ||
Makefile | ||
|
||
all: device_sel $(target).hex | ||
|
||
device_sel: | ||
@echo | ||
echo "include $(device)" > device_select.jal | ||
|
||
$(target).hex: $(main_file) $(depends) | ||
$(jal_cc) $(jal_flags) -hex $@ $(main_file) | ||
|
||
.PHONY: clean flash f flash2 f2 flash3 f3 | ||
|
||
# ------------ | ||
# Flash writer setting | ||
# ------------ | ||
MPLABX_VER = 5.35 | ||
|
||
# for Pickit3 | ||
flash_writer=C:\MPLABX\v$(MPLABX_VER)\mplab_platform\mplab_ipe\ipecmd.exe | ||
# for Pickit3 alternative | ||
flash_writer3=C:\MPLABX\v$(MPLABX_VER)\mplab_platform\mplab_ipe\pk3cmd.exe | ||
# for Pickit2 | ||
flash_writer2 = pk2cmd.exe | ||
|
||
f: flash | ||
f2: flash2 | ||
f3: flash3 | ||
|
||
# for pickit3 | ||
flash: all | ||
$(flash_writer) -TPPK3 -P$(device) -F$(target).hex -M -OL | ||
|
||
# for pickit3 alternative | ||
flash3: all | ||
$(flash_writer3) -P$(device) -F$(target).hex -M -L | ||
|
||
# for pickit2 | ||
flash2: all | ||
$(flash_writer2) -P -F$(target).hex -M -R -Y -J | ||
|
||
clean: | ||
$(rm) $(target).hex $(main_name).asm $(main_name).cod \ | ||
$(main_name).out $(main_name).hex \ | ||
00build.log \ | ||
log.0 log.1 log.2 \ | ||
MPLABXLog.* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
## PWM Wave Player Super Lite for PIC16F1xxx with [Jalv2](http://www.justanotherlanguage.org/downloads) | ||
I came across this page [WAVE PLAYER FOR PIC16F877A.!](https://libstock.mikroe.com/projects/view/120/wave-player-for-pic16f877a) and had a impression for very small code size about 1700 words. But I struggled with the program that aimed to old and paticular MMC FAT16 format in the now, so I rewrite it using Jalv2(Jal) language in order to work with SDSC/SDHC SD card (FAT16/FAT32)from 2GB to 32GB. | ||
|
||
### Specification: | ||
1. Supported PICs are 8bit Enhanced Midrange PIC16F1xxx series and PIC18F26J50 etc, as follows: | ||
- **Programmed by PicKit2/3:** | ||
PIC12F1840 | ||
PIC16F1455,PIC16F1459 | ||
PIC16F1705,PIC16F1709 | ||
PIC16F1825,PIC16F1827,PIC16F1829 | ||
PIC16F1938 | ||
PIC18F14K50 | ||
PIC18F26J50 | ||
- **Programmed by PicKit3 or later:** | ||
PIC16F1619 | ||
PIC16F1764 | ||
PIC16F18313 | ||
PIC16F18325 | ||
1. PCM wave music file: Select 8bit stereo or mono. fs=44.1KHz fixed. | ||
1. Auto play after power on. | ||
1. One push switch controls **Play**,**Pause** and **Next song** oparation. | ||
1. Code size is about 1700 words. | ||
|
||
### Youtube demo movie: | ||
[![alt_image](https://img.youtube.com/vi/41IuUC8VG0o/0.jpg)](https://www.youtube.com/watch?v=41IuUC8VG0o) | ||
|
||
### Schematic: | ||
* Refer to **pin_map.txt** in the archive file. | ||
![img](http://mpu.up.seesaa.net/image/pic16f18313-sd-wave-player_breadborad-2017-2.png) | ||
![img](http://mpu.up.seesaa.net/image/pic16f18313-sd-wave-player_schematic-2017.png) | ||
![img](http://mpu.up.seesaa.net/image/pic16f1827-wav-sd-player-schematic-2017.png) | ||
|
||
### Output filter: | ||
* Schematic | ||
![img](http://mpu.up.seesaa.net/image/pwm-filter-output.png) | ||
|
||
### SD Card connection: | ||
* Pin side | ||
``` | ||
--------------\ | ||
9 = \ DAT2/NC | ||
1 ===| CS/DAT3 [CS] | ||
2 ===| CMD/DI [DI] | ||
3 ===| VSS1 | ||
Bottom 4 ===| VDD | ||
View 5 ===| CLK [CLK] | ||
6 ===| VSS2 | ||
7 ===| DO/DAT0 [DO] | ||
8 =| DAT1/IRQ | ||
----------------- | ||
``` | ||
* Logo side | ||
``` | ||
Arduino NUCLEO-F411 NUCLEO-F030R8 | ||
----------------- | ||
8 =| DAT1/IRQ | ||
7 ===| DO/DAT0 [DO] D12 D12/PA_6 D12/PA_6 | ||
6 ===| VSS2 | ||
Top 5 ===| CLK [CLK] D13 D13/PA_5 D13/PA_5 | ||
View 4 ===| VDD | ||
3 ===| VSS1 | ||
2 ===| CMD/DI [DI] D11 D11/PA_7 D11/PA_7 | ||
1 ===| CS/DAT3 [CS] D8 D10/PB_6 D10/PB_6 | ||
9 = / DAT2/NC | ||
--------------/ | ||
``` | ||
### Pickit2/3 pin map | ||
``` | ||
------------------ | ||
Pickit2/3 pin map | ||
------------------ | ||
----------- | ||
\ | ||
\ | ||
==> |1 Vpp/MCLR | ||
|2 VDD Target | ||
|3 Vss ground | ||
|4 ICSPDAT/PGD | ||
|5 ICSPCLK/PGC | ||
|6 Aux N.C. | ||
/ | ||
/ | ||
------------ | ||
``` | ||
### Download: | ||
* Latest version | ||
[16f-pwm-wave-player_jalv2_v8.8-2019-02.zip](https://bitbucket.org/dinau/16f-pwm-wav-sd-card-player/downloads/16f-pwm-wave-player_jalv2_v8.8-2019-02.zip) | ||
If you need to recompile the source code, use this Jalv2 version : [jallib_full-1.2.0.zip](http://www.justanotherlanguage.org:3389/sites/default/files/ftp_server/builds/old_releases/jallib_full-1.2.0.zip) | ||
* Old version | ||
[16f-pwm-wave-player_v8.6-2017-02.zip](https://bitbucket.org/dinau/16f-pwm-wav-sd-card-player/downloads/16f-pwm-wave-player_v8.6-2017-02.zip) | ||
If you need to recompile the source code, use this Jalv2 version : [jallib_full-1.2.0.zip](http://www.justanotherlanguage.org:3389/sites/default/files/ftp_server/builds/old_releases/jallib_full-1.2.0.zip) | ||
### Write hex file to flash: | ||
You can find hex files in hex folder, | ||
for instance, | ||
sd-wav-player-**16F1705**-v8.8-2019-02.hex | ||
You can write this file to flash using PicKit2/3 Programmer. | ||
### Converting to fs=44.1kHz,PCM 8bit stereo or mono data: | ||
For **8pin** PICs: The .wav files must be converted to 'Mono' data. | ||
For other PICs:The .waf files must be converted to 'Stereo' data. | ||
Use converter tools, example, | ||
[foobar2000](https://www.foobar2000.org/) | ||
[Audacity](https://www.audacityteam.org/) | ||
[SoX](http://sox.sourceforge.net/) | ||
etc. | ||
### Supported SD card: | ||
SDSC/SDHC card, | ||
FAT16 and FAT32. | ||
1. At first, format SD card with [SD Card Formatter](https://www.sdcard.org/downloads/formatter_4/index.html) | ||
1. Copy PCM wav files to the SD card in root directory. | ||
### References: | ||
* Wave Player Super Lite family | ||
* [Nim: AVR Arduino Uno/Nano version is here. ](https://github.com/dinau/arduino-wave-player-pwm-super-lite-nim) | ||
* [Nim: ARM STM32 version is here. ](https://github.com/dinau/stm32-wave-player-pwm-super-lite-nim) | ||
* [C/C++: mbed version is here.](https://os.mbed.com/users/mimi3/code/wave_player_super_lite/) | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
---------------------------------------------------------------- | ||
For PIC16F enhanced midrange, wave player using pwm with SD card. | ||
PCM Stereo/Mono,44.1KHz,8bit, | ||
FAT16/FAT32 support. | ||
|
||
This project is licensed under BSD license. | ||
---------------------------------------------------------------- | ||
|
||
* You can write HEX file to PIC respectively where the files attached in 'hex' directory. | ||
|
||
* If you would like to have HEX files to compile from source file, | ||
use this compiler and libraries. | ||
jallib-full-1.6.0 | ||
http://justanotherlanguage.org/sites/default/files/ftp_server/builds/release/jallib_full-1.6.0.zip | ||
|
||
* Compilation from source code. | ||
(1) Edit m.bat : Windows batch file. | ||
Specify properly 'device' and 'compiler_root' variables in the file, | ||
and execute 'm.bat' on Windows command line console. | ||
or | ||
(2) Edit Makefile, | ||
The variables below must be properly edited as match your environment, | ||
for example, | ||
jal_root = d:/0pic-data/jalv2-data | ||
jal_sys = $(jal_root)/jallib_full-1.6.0 | ||
Specify PIC MCU: Delete '#' from top of the line,for example | ||
device=16F1827 | ||
and issue the make command on msys2 console or on Windows command line console. | ||
|
||
* Schematics | ||
Provided only two schematics, | ||
(1) For PIC12F1840 / PIC16F18313 refer to | ||
doc/pic16f18313-sd-wave-player_schematic-2017.png | ||
doc/pic16f18313-sd-wave-player_breadborad-2017.png | ||
(2) For PIC18F1827 refer to | ||
doc/PIC16F1827-wav-sd-player-schematic-2017.png | ||
Other schematics are abbreviated, but please refer to 'pin_map.txt' for other PICs. | ||
You could wire other wave players by referencing the diagrams in 'pin_map.txt'. | ||
|
||
* Other information | ||
Web page: Local language only at this moment. | ||
http://mpu.seesaa.net/article/445037481.html | ||
|
||
|
||
History | ||
------- | ||
v9.1: 2021/11 by avrin: Just maintenance release so far. | ||
v9.0: 2019/11 by avrin: | ||
* Fixed compilation error of pic16f1455 due to undefinition for 'pin_A1_direction'. | ||
* fat_lib.jal: Changed some variable names and reduced some SRAMs. | ||
v8.9: 2019/10 by avrin: Modified PPS setting with jallib_full-1.4.0 or jallib_full-1.3.0. | ||
v8.8: 2019/02 by arvrn: Simplified source code. | ||
v8.6: 2017/02 by avrin: First release. | ||
|
Oops, something went wrong.