Sunday, August 3, 2014

Bascom AVR - USB Add On

Price: EUR 29
The USB Add On is an Add On for BASCOM-AVR.
USB support for the all AT90USB and MEGA USB series was added to BASCOM (except XMEGA chips). Some USB chips support host and device modes.
The USB162 supports only the device mode. It is a perfect chip for many projects that require an USB interface.
 
The Add On consists of the following :
-   An include file that is written in BASCOM-AVR BASIC with mixed assembler.
-   An OCX control that can be used for communication with HID devices.
-   A simple VB project that explains how to use the OCX control
-   Three examples that demonstrate CDC (serial class), generic HID device(input and output) , HID keyboard class.

Actual list of supported chips :
  • AT90USB82
  • AT90USB162
  • AT90USB646
  • AT90USB1286
  • AT90USB1287
  • Mega 8U2
  • Mega 16U2
  • Mega 16U4
  • Mega 32U2
  • Mega 32U4
 

Don't forget view HID example program below !

(The USB Add requires a BASCOM-AVR serial. If you want to purchase both, use the temporarily serial AA-0000-00001) 

I2C Slave Library (Download version)

Price: EUR 14.95
This product is provided as down-loadable without any storage media and is billed without shipping.
I2CSLAVE is an add-on product for BASCOM-AVR.

It allows you to turn an AVR micro into an I2C slave chip.

You could start your own factory for I2C chips: create your own PCF8574 , I2C LCD display etc.
The I2C Slave add on comes with different libraries for different AVR processors.

There is the plain soft mode library which uses the TIMER and INT interrupts and it is intended for the older AVR chips which do not have TWI or USI like  2313,2323, 2333,2343,4433 and tiny22.
Then there is a Library for AVR processors that have built in TWI hardware (TWI-I2C).
This should be used for processors like M8,M32, M64,M128, M644, etc.

And  most TINY processors come with an USI. There is a library that can be used with the USI as well. This is for processors like : tiny2313,  tiny4313,  tiny24,  tiny44,  tiny 84, tiny25,  tiny45 , tiny85,  tiny26,  tiny261,  tiny461, m169, m165 , m325,  m3250,  m645,  m6450,  m329,  m649, tiny87,  tiny167 and tiny43U

For the XMEGA there is a separate library. 

The library works similar for all libraries but there are subtle differences. Use the examples and the help to get started.

While a big range of the AVR processors is supported with a library, not all AVR’s can be turned into an I2C slave.
Here is a small sample for the atTiny2313 with USI.
 

'-------------------------------------------------------------------------------
'                            (c) 2004-2014 MCS Electronics
'          This demo demonstrates the USI I2C slave
'          This is part of the I2C Slave library which is a commercial addon library
'          Not all AVR chips have an USI !!!!
'-------------------------------------------------------------------------------
$regfile = "attiny2313.dat"
$crystal = 8000000
$hwstack = 40
$swstack = 16
$framesize = 24
const cPrint = 0                                            'make 0 for chips that have NO UART, make 1 when the micro has a UART and you want to show data on the terminal
#if cPrint
 $baud = 19200                                            'only when the processor has a UART
#endif
config usi = twislave , address = &H40                      'bascom uses 8 bit i2c address (7 bit shifted to the left with one bit)
#if cPrint
 print "USI DEMO"
#endif
'do not forget to enable global interrupts since USI is used in interrupt mode
enable interrupts 'it is important you enable interrupts
do
 ! nop ; nothing to do here
loop


'The following labels are called from the library. You need to insert code in these subroutines
'Notice that the PRINT commands are remarked.
'You can unmark them and see what happens, but it will increase code size
'The idea is that you write your code in the called labels. And this code must execute in as little time
'as possible. So when you slave must read the A/D converter, you can best do it in the main program
'then the data is available when the master requires it, and you do not need to do the conversion which cost time.

'A master can send or receive bytes.
'A master protocol can also send some bytes, then receive some bytes
'The master and slave address must match.
'the following labels are called from the library  when master send stop or start
Twi_stop_rstart_received:
 '  Print "Master sent stop or repeated start"
Return
'master sent our slave address and will not send data
Twi_addressed_goread:
 ' Print "We were addressed and master will send data"
Return

Twi_addressed_gowrite:
 '  Print "We were addressed and master will read data"
Return
'this label is called when the master sends data and the slave has received the byte
'the variable TWI holds the received value
Twi_gotdata:
 '   Print "received : " ; Twi ; " byte no : " ; Twi_btw
 Select Case Twi_btw
 Case 1 : 'Portd = Twi                                   ' first byte
 Case 2: 'you can set another port here for example
 End Select
Return
'this label is called when the master receives data and needs a byte
'the variable twi_btr is a byte variable that holds the index of the needed byte
'so when sending multiple bytes from an array, twi_btr can be used for the index
Twi_master_needs_byte:
 '  Print "Master needs byte : " ; Twi_btr
 Select Case Twi_btr
 Case 1 : twi = 68                                       ' first byte
 Case 2 : twi = 69                                       ' send second byte
 End Select 'you could also return the state of a port pin or A/D converter
Return

Monday, July 28, 2014

Bascom AVR (Download version)

Price: EUR 89
BASCOM-AVR© is the original Windows BASIC COMPILER for the AVR family It is designed to run on  XP/VISTA/WIN7 and WIN8
This product description is updated in 2014. But we do not change it each time we update the software. In the on line help you can find a list of all statements and functions.

Key Benefits

  • Structured BASIC with labels.
  • Structured programming with IF-THEN-ELSE-END IF, DO-LOOP, WHILE-WEND, SELECT- CASE.
  • Fast machine code instead of interpreted code.
  • Variables and labels can be as long as 32 characters.
  • Bit, Byte, Integer, Word, Long, Single, Double and String variables.
  • Large set of Trig Floating point functions.
  • Date & Time calculation functions.
  • Compiled programs work with all AVR microprocessors that have internal memory.
  • Statements are highly compatible with Microsoft’s VB/QB.
  • Special commands for LCD-displays , I2C chips and 1WIRE chips, PC keyboad, matrix keyboad, RC5 reception, software UART, SPI , graphical LCD, send IR RC5,RC6 or Sony code.
  •  TCP/IP with W3100A/W5100/W5200/W5300 chips.
  • Built in AVR-DOS functions like MKDIR, CHDIR, DIR, OPEN, CLOSE, etc. Just as they work in  QB/VB !
  • Local variables, user functions, library support.
  • Integrated terminal emulator with download option..
  • Integrated simulator for testing.
  • Integrated ISP programmer (application note AVR910.ASM).
  • Integrated STK200 programmer and STK300 programmer. Also supported is the low cost Sample Electronics programmer. Can be built in 10 minutes! Many other programmers supported via the Universal Interface.
  • Many supported programmer like STK500, STK600, MKII, USBASP, JTAG , Arduino
  • Editor with statement highlighting.
  • Context sensitive help.
  • DEMO version compiles 4KB of binary code. Well suited for the ATmega48.
  • English an German Books available
  •  AT mouse simulator, AT keyboard simulator, I2C Slave available as add on.
  • This product is developed in 1995 and is updated regularly.

The following statements are supported (actually there are many more look in the on line helpfile):
Decision and structuresIF, THEN, ELSE, ELSEIF, END IF, DO, LOOP, WHILE, WEND, UNTIL, EXIT DO, EXIT WHILE, FOR, NEXT, TO, STEP, EXIT FOR, ON .. GOTO/GOSUB, SELECT, CASE.
Input and outputPRINT, INPUT, INKEY, PRINT, INPUTHEX, LCD, UPPERLINE, LOWERLINE,DISPLAY ON/OFF, CURSOR ON/OFF/BLINK/NOBLINK, HOME, LOCATE, SHIFTLCD LEFT/RIGHT, SHIFTCURSOR LEFT/RIGHT, CLS, DEFLCDCHAR, WAITKEY, INPUTBIN, PRINTBIN, OPEN, CLOSE, DEBOUNCE, SHIFTIN, SHIFTOUT, GETATKBD, SPC, SERIN, SEROUT
Numeric functionsAND, OR, XOR, INC, DEC, MOD, NOT, ABS, BCD, LOG, EXP, SQR, SIN,COS,TAN,ATN, ATN2, ASIN, ACOS, FIX, ROUND, MOD, SGN, POWER, RAD2DEG, DEG2RAD, LOG10, TANH, SINH, COSH.
I2CI2CSTART, I2CSTOP, I2CWBYTE, I2CRBYTE, I2CSEND and I2CRECEIVE.
1WIRE1WWRITE, 1WREAD, 1WRESET, 1WIRECOUNT, 1WSEARCHFIRST, 1WSEARCHNEXT.
SPISPIINIT, SPIIN, SPIOUT, SPIMOVE.
TCP/IP
TCP/IP routines can be used with the W3100/IIM7000/IIM7010/W5100/W5200/W5300 modules.
 Interrupt programmingON INT0/INT1/TIMER0/TIMER1/SERIAL, RETURN, ENABLE, DISABLE, COUNTERx, CAPTUREx, INTERRUPTS, CONFIG, START, LOAD.
Bit manipulationSET, RESET, ROTATE, SHIFT, BITWAIT, TOGGLE.
VariablesDIM, BIT , BYTE , INTEGER , WORD, LONG, SINGLE, DOUBLE, STRING , DEFBIT, DEFBYTE, DEFINT, DEFWORD.
MiscellaneousREM, ' , SWAP, END, STOP, CONST, DELAY, WAIT, WAITMS, GOTO, GOSUB, POWERDOWN, IDLE, DECLARE, CALL, SUB, END SUB, MAKEDEC, MAKEBCD, INP,OUT, ALIAS, DIM , ERASE, DATA, READ, RESTORE, INCR, DECR, PEEK, POKE, CPEEK, FUNCTION, READMAGCARD, BIN2GREY, GREY2BIN, CRC8, CRC16, CRC32, CHECKSUM.
Compiler directives$INCLUDE, $BAUD and $CRYSTAL, $SERIALINPUT, $SERIALOUTPUT, $RAMSIZE, $RAMSTART, $DEFAULT XRAM, $ASM-$END ASM, $LCD, $EXTERNAL, $LIB.
String manipulationSTRING, SPACE, LEFT, RIGHT, MID, VAL, HEXVAL, LEN, STR, HEX, LTRIM, RTRIM, TRIM, LCASE, UCASE, FORMAT, FUSING, INSTR, CHARPOS.
And many other functions, statements and directives

To make a program takes just a few steps :

  • Write the program in BASIC
  • Compile it to fast machine binary code
  • Test the result with the integrated simulator(with additional hardware you can simulate the hardware too).
  • Program the chip with one of the integrated programmers.(hardware must be purchased separately)
 

This is a screen shot of the editor. You can work in normal mode or project mode.
At the left you find the Code Explorer. The Code explorer can show unused data in a different colour.

When the Code Explorer is visible, the editor supports Proper Indent and Indent drawing.
Indent lines can be a great visual help.

A tool tip with info can be shown by pressing SHIFT :

Here it is clear that BDIL is a byte variable, dimensioned in the module CAN-Elektor.bas
It will show info for constants, aliases, variables and functions.

Bascom 8051 (Download version)

Price: EUR 79

BASCOM-8051© is the Windows BASIC COMPILER for the 8051 family.
It is designed to run on 
 XP/VISTA/WIN7/WIN8 and has all the features of BASCOM LT.
In addition it has full support for arrays and the single floating point data type.

Key Benefits
  • Structured BASIC with labels.
  • Structured programming with IF-THEN-ELSE-END IF, DO-LOOP, WHILE-WEND, SELECT- CASE.
  • Fast machine code instead of interpreted code.
  • Variables and labels can be as long as 32 characters.
  • Bit, Byte, Integer, Word, Long, Single and String variables.
  • Compiled programs work with any 8051 uP such as AT89C1051, AT89C2051, 8031, 8032, 8051, 8052, 80552, 80535 and 80537  Processors.
  • Statements are highly compatible with Microsoft’s VB/QB.
  • Special commands for LCD-displays , I2C chips and 1WIRE chips.
  • Integrated terminal emulator with download option.
  • Integrated simulator for testing.
  • Integrated flash programmer and support for SPI, PG2051, PG302, SE512, SE514, TAFE. (hardware can be purchased separately)
  • Editor with statement highlighting.
  • Context sensitive help.
  • For compatibility with BASCOM LT, there is also a 32-bit version of the BASCOM LT compiler.

The following statements are supported :

Decision and structures
IF, THEN, ELSE, ELSEIF, END IF, DO, LOOP, WHILE, WEND, UNTIL, EXIT DO, EXIT WHILE, FOR, NEXT, TO, DOWNTO, STEP, EXIT FOR, ON .. GOTO/GOSUB, SELECT, CASE.

Input and output
PRINT, INPUT, INKEY, PRINTHEX, INPUTHEX, LCD, UPPERLINE, LOWERLINE,DISPLAY ON/OFF, CURSOR ON/OFF/BLINK/NOBLINK, HOME, LOCATE, SHIFTLCD LEFT/RIGHT, SHIFTCURSOR LEFT/RIGHT, CLS, DEFLCDCHAR, WAITKEY, INPUTBIN, PRINTBIN, LCDHEX, OPEN, CLOSE, DEBOUNCE, SHIFTIN, SHIFTOUT.

Numeric functions
AND, OR, XOR, INC, DEC, MOD, NOT, ABS, BCD.

I2C
I2CSTART, I2CSTOP, I2CWBYTE, I2CRBYTE, I2CSEND and I2CRECEIVE.

1WIRE
1WWRITE, 1WREAD, 1WRESET.

SPI
SPIINIT, SPIIN, SPIOUT.

Interrupt programming
ON INT0/INT1/TIMER0/TIMER1/SERIAL, RETURN, ENABLE, DISABLE, PRIORITY SET/RESET, COUNTERx, CAPTUREx, INTERRUPTS, CONFIG, START, LOAD.

Bit manipulation
SET, RESET, ROTATE, BITWAIT.

Variables
DIM, BIT , BYTE , INTEGER , WORD, LONG, SINGLE, STRING , DEFBIT, DEFBYTE, DEFINT, DEFWORD.

Miscellaneous
REM, ' , SWAP, END, STOP, CONST, DELAY, WAIT, WAITMS, GOTO, GOSUB, POWERDOWN, IDLE, DECLARE, CALL, SUB, END SUB, MAKEDEC, MAKEBCD, INP,OUT, ALIAS, DIM , ERASE, DATA, READ, RESTORE, INCR, DECR, PEEK, POKE, CPEEK, GETRC5.

Compiler directives
$INCLUDE, $NOINIT, $BAUD and $CRYSTAL, $OBJ, $SERIALINPUT, $SERIALOUTPUT, $ROMSTART, $RAMSIZE, $RAMSTART, $MONSTART, $IRAMSTART, $DEFAULT XRAM, $ASM-$END ASM, $LCD.

Conditional compilation
#IF, #ELSE, #ENDIF

String manipulation
STRING, SPACE, LEFT, RIGHT, MID, VAL, HEXVAL, LEN, STR, HEX, LCASE, UCASE

To make a program takes just a few steps :

  • Write the program in BASIC
  • Compile it to fast machine binary code
  • Test the result with the integrated simulator (with additional hardware you can simulate the hardware too)
  • Program the chip with one of the integrated programmers (hardware must be purchased separately)

The 8051 processor is included in many special chips.  BASCOM creates standard 8051 object code. So the object code can run on any 8051 compatible processor.

While we offer so called DAT files for many processors, it is impossible to write a DAT file for all the 8051 variants. The DAT files are however easy to make. They contain the hardware register names with their address. 

The only thing you need to take care about is that some processors have modified instruction cycles. This means that these processors execute code faster than a normal 8051. This can effect some statements like WAITMS, WAIT, DELAY and other software timed instructions.

BASCOM-8051 IDE


BASCOM-8051 Simulator



BASCOM-8051 Programmer




BASCOM-8051 Graphic converter