amforth 3.0 mFC - modular Forth Computer ======================================== 28.07.2009, amforth30mFC12, all recompiled, asm in bitnames, new mmc.frt 20.03.2009, amforth30mFC11, add module RAM 30.01.2009, Lubos Pekny, www.forth.cz/Download/mFC/mFC.html (add multi-processor half-duplex communication, crc, anti-collision, vocabulary, applicable for one-processor full-duplex also) amforth30mFC12 -------------- Assembler is used in library bitnames, spi, ram, mmc for quick access to ports. 30kB/s transfer rate before, 370kB/s now. SD card Panasonic is very good, noname has problems with read (CID-CSD.txt). Remake all hex files. HEX and EEP files for Ponyprog ------------------------------- AVR Studiu 4.12, assembler2. Sequence libraries in makefile.frt: - assembler, , , , , , , Main.hex - amforth 3.0 mFC12, Atmega32, 16MHz, modif.half-duplex, vocabulary Main.eep - data eeprom Main_asm.hex - add library assembler.frt Main_asm.eep - data eeprom Main_bit.hex - add library bitnames.frt, I/O ports Main_bit.eep - data eeprom Main_spi.hex - add library spi.frt, SPI port Main_spi.eep - data eeprom Main_mpc.hex - add library mpc485.frt, multi-processor communication Main_mpc.eep - data eeprom Main_lcd.hex - add library LCD20x4scr.frt, display LCD20x4 Main_lcd.eep - data eeprom Main_kbd.hex - add library keyboard.frt, keyboard PS2 Main_kbd.eep - data eeprom Main_ram.hex - add library ram.frt, module RAM 512kB Main_ram.eep - data eeprom Main_mmc.hex - add library mmc.frt, MMC/SD card Main_mmc.eep - data eeprom Memory flash free space 12kB Security bits ------------- checked, programmed - JTAGEN, CKOPT, BOOTSZ1,BOOTSZ0, BODEN, BODLEVEL Library changes - mpc --------------------- antic.asm - new, test RX pin, add anti-collision delay for TX echo.asm - new, variable echo, crc16 accept.asm - add on/off echo applturnkey.asm - add init mpc_ID, echo, antic refill.asm - add crc16 test rx0.asm - add multi-processor mode, variable mpc_ID tx0.asm - add usart0_utx_isr, anti-collision delay amforth.asm - add mpcID to eeprom, default $lA(154) atmega32.asm - enabled TXC interrupt dict_minimum.inc - add file antic.asm, echo.asm Main.asm - set I/O pins Library changes - vocabulary ---------------------------- vocabul.asm - vocabulary, definitions, context, current, forth, assembler find.asm - search context, current vocabulary code.asm - add ... assembler ... colon.asm, end-code.asm - add ... current @ context ! ... XT_HEADCON replace XT_HEAD in words: find, words XT_HEADCUR replace XT_HEAD in words: docreate, does, immediate, recurse !MakeFile.frt include all files and words for complete system. mpc485.frt - Multi-processor communication with half-duplex RS485 ----------------------------------------------------------------- Communication master-slave is text with 7-bit chars, bit D7=0. For adress is D7=1. If master send to net text ~end , then moduls receive it and switch-off. If any modul receive your ID+$80 then switch-on. You can modul ID:2 switch-on by command 2 ~call or press alt+0130 or alt+ctrl+shft+B for keyboard.frt. When modul is on, you can change your ID, default is $1A (26, alt+0154, ctrl+alt+shft+Z). Default echo off, antic off, crc off. If you view ddrroopp then use -echo, when nothing then +echo. Use +antic for anti-collision TX. Use +crc for checked transmit. If crc is used, then is possible transmit text from source editor only (Forfiter), no write on-line, also -crc you must send from source editor. ~line send/receive crc check also. Format crc: text+D+xxxx where text are commands, D is byte $D=Cursor return, xxxx is crc as hexadecimal text. Block is repeated until char $06 (ACK) is received. If more moduls are switch-on then answer is running in loop. For break loop you send ~end +crc , or try press backspace, enter. mpc_ID - identification, modul ID = 0..127 c mpc_ID! - set ID in eeprom ~id - read mpc_ID ~end - modul is waiting for address $80+ID (~end \ switch-off moduls on line, if send char $82 (alt+0131) then choose modul ID:2) c ~call - switch-on modul c, switch-off current c ~line - current modul send command line for modul c (5 ~line 4 3 + . ~end \ current modul send text 4 3 + . ~end for modul ID:5) +echo, -echo - on/off echo +crc, -crc - on/off crc check +antic, -antic - on/off anti-collision, add TX delay, delayTX=(2+ID)/2 chars. Problems? --------- - check cables, polarity (5V, RS485) - set vocabulary, definitions ( , definitions) - set root (forth , forth ) - check ID ( ~id . , 26 default) - check crc, echo, echo.7 (no accept commands, no view commands, slave) - slave is waiting (1A ~call, alt+0154, ctrl+alt+shft+Z for send ID) - appl_kbdlcd need echo from keyboard (+echo) - ID and echo from eeprom are copied to RAM after restart Tested with FTDI USB-RS485 converter, 2x mFC_CPU, win Forfiter.exe