START

Top  Previous  Next

Action

Start the specified device.

 

 

Syntax

START device

 

 

Remarks

Device

TIMER0, TIMER1, COUNTER0 or COUNTER1, WATCHDOG, AC (Analog comparator power), ADC(A/D converter power) or DAC(D/A converter)

XMEGA

For the Xmega you can also specify : DACA or DACB for the Digital/Analog Converters A and B.

 

You must start a timer/counter in order for an interrupt to occur (when the external gate is disabled).

TIMER0 and COUNTER0 are the same device.

 

The AC and ADC parameters will switch power to the device and thus enabling it to work.

 

 

See also

STOP

 

 

Example

'--------------------------------------------------------------------------------

'name                     : adc.bas

'copyright                : (c) 1995-2005, MCS Electronics

'purpose                  : demonstration of GETADC() function for 8535 or M163 micro

'micro                    : Mega163

'suited for demo          : yes

'commercial addon needed  : no

'use in simulator         : possible

' Getadc() will also work for other AVR chips that have an ADC converter

'--------------------------------------------------------------------------------

$regfile = "m163def.dat"                                   ' we use the M163

$crystal = 4000000

 

$hwstack = 32                                               ' default use 32 for the hardware stack

$swstack = 10                                               'default use 10 for the SW stack

$framesize = 40                                             'default use 40 for the frame space

 

 

'configure single mode and auto prescaler setting

'The single mode must be used with the GETADC() function

 

'The prescaler divides the internal clock by 2,4,8,16,32,64 or 128

'Because the ADC needs a clock from 50-200 KHz

'The AUTO feature, will select the highest clockrate possible

Config Adc = Single , Prescaler = Auto

'Now give power to the chip

Start Adc

 

'With STOP ADC, you can remove the power from the chip

'Stop Adc

 

Dim W As Word , Channel As Byte

 

Channel = 0

'now read A/D value from channel 0

Do

W = Getadc(channel)

Print "Channel " ; Channel ; " value " ; W

Incr Channel

If Channel > 7 Then Channel = 0

Loop

End

 

'The new M163 has options for the reference voltage

'For this chip you can use the additional param :

'Config Adc = Single , Prescaler = Auto, Reference = Internal

'The reference param may be :

'OFF      : AREF, internal reference turned off

'AVCC     : AVCC, with external capacitor at AREF pin

'INTERNAL : Internal 2.56 voltage reference with external capacitor ar AREF pin

 

'Using the additional param on chip that do not have the internal reference will have no effect.