© 2013 Conrad ElectronicC-Control Pro IDE
91 C-Control Pro IDE© 2013 Conrad ElectronicExample connect RS232 to UART0This product complies with the applicable national and European requirements
92Hardware© 2013 Conrad Electronic
93 C-Control Pro IDE© 2013 Conrad Electronic2.2.4.1Connection Diagram
94Hardware© 2013 Conrad Electronic
95 C-Control Pro IDE© 2013 Conrad Electronic2.2.5 MainboardThe C-Control PRO AVR32Bit Mainboard (Conrad Order No.: 192702) is a compact experim
96Hardware© 2013 Conrad ElectronicThe board offers the following features:1x power supply (3.3V & 5V)1x LAN connector (RJ45) 1x 2.048V external re
97 C-Control Pro IDE© 2013 Conrad ElectronicUNIT-BUS Pin ConfigurationReference VoltageThe jumper JP3 connects the external 2.048V reference voltag
98Hardware© 2013 Conrad ElectronicMatching connection cable pre-assembled (length 35cm) Order No. 1988761-WIREAt the screw clamp labeled "1WIRE&q
99 C-Control Pro IDE© 2013 Conrad Electronic3x JumperQuick Guide
100Hardware© 2013 Conrad Electronic2.2.5.1Connection Diagram
2Important Notes© 2013 Conrad ElectronicImportant Notes1This chapter deals with important information's to warranty, support and operation of the
101 C-Control Pro IDE© 2013 Conrad Electronic2.2.6 UNIT-BUS Exp. BoardThe C-Control PRO AVR32Bit UNIT BUS Exp. Board (Conrad Order No.: 192659) is des
102Hardware© 2013 Conrad Electronic2.2.6.1Connection Diagram
103 C-Control Pro IDE© 2013 Conrad Electronic2.2.7 LCD1602 BoardThe C-Control PRO AVR32Bit LCD1602 board (Conrad Order No. 192602) is designed to expa
104Hardware© 2013 Conrad ElectronicPCB Rear View Is the base address of the LCD used (equal to the application board), the jumper must be re-moved o
105 C-Control Pro IDE© 2013 Conrad ElectronicThe I2C address jumpers JP1 and JP3 are located on the back of the LCD1602 module. With theuse of multipl
106Hardware© 2013 Conrad Electroniccurrent consumption with backlight13mAweight55g
107 C-Control Pro IDE© 2013 Conrad Electronic2.2.7.1Connection Diagram
108Hardware© 2013 Conrad Electronic2.2.8 Port-Ext-BoardThe Port-Ext-Board (Conrad Order No. 192615) is constructed to expand the functionality of the
109 C-Control Pro IDE© 2013 Conrad ElectronicPort-Extension-Board Overview
110Hardware© 2013 Conrad ElectronicCADTechnical Data:dimensions110mm x 90mm x 13mm (LxWxH)pin header pitch2.54mmbreadboard pitch2.54mmbreadboard size2
3 C-Control Pro IDE© 2013 Conrad Electronic1.4 Intended useThe C-Control Pro Unit is an electronic device in the sense of an integrated circuit. It se
111 C-Control Pro IDE© 2013 Conrad Electronic2.2.9 REL4-BoardThe C-Control PRO AVR32Bit REL4 Board (Conrad Order No. 192631) is designed to expand
112Hardware© 2013 Conrad Electronicexceed 2m, since this will cause communication errors. However, when longer lines are needed, it ishelpful to put a
113 C-Control Pro IDE© 2013 Conrad Electronicx-xHex 22xx-Hex 21xxxHex 20x=Jumper set / - = not set Attention: Other I2C bus modules use the same I2C
114Hardware© 2013 Conrad Electronicoperating voltage12Vcurrent consumption120mAweight70g
115 C-Control Pro IDE© 2013 Conrad Electronic2.2.9.1Connection Diagram
116Hardware© 2013 Conrad Electronic2.2.10 RELBUS-BoardThe C-Control PRO AVR32Bit RELBUS-Board (Conrad Order No. 192645) is designed to expand thefunct
117 C-Control Pro IDE© 2013 Conrad ElectronicRELBUS-Board overviewThe RELBUS-Board has two UNIT-BUS connections that are mutually connected 1:1.
118Hardware© 2013 Conrad ElectronicBeispiel Verbraucheranschluss an Ausgang Q1 Attention: Other I2C bus modules use the same I2C expander chips (PCA8
119 C-Control Pro IDE© 2013 Conrad ElectronicxxxHex 20x=Jumper set / - = not setCAD Info: The RELBUS-Board can be mounted on a DIN rail by Phoenix Co
120Hardware© 2013 Conrad Electronic2.2.10.1Connection Diagram
4Important Notes© 2013 Conrad Electronic1.6 ServiceConrad Electronic provides you with a team of experienced service technicians. If you have anyquest
121 C-Control Pro IDE© 2013 Conrad Electronic2.2.11 UNIT-BUS Ext-BoardThe C-Control PRO AVR32Bit UNIT BUS Ext board (Conrad Order No. 192673) is desi
122Hardware© 2013 Conrad Electronic Tip: The pin header connectors can be easily pressed together with a small vise. Cut the cableto proper length an
123 C-Control Pro IDE© 2013 Conrad ElectronicCADTechnical Data:dimensions110mm x 90mm x 13mm (LxWxH)pin header pitch2.54mmhole grid pitch (PCB)2.54mmd
124Hardware© 2013 Conrad Electronic2.2.12 USB-BoardThe C-Control PRO AVR32Bit USB-Board (Conrad Order No. 192688) is designed to expand thefunct
125 C-Control Pro IDE© 2013 Conrad ElectronicCADTechnical Data:dimensions23mm x 25mm x 12mm (LxWxH)UART pin pitch2.54mmUSBType-Boperating voltagepower
126Hardware© 2013 Conrad Electronic2.2.12.1Connection Diagram
127 C-Control Pro IDE© 2013 Conrad Electronic2.3 LCD MatrixThe complete datasheets are on the CD-ROM in the directory "Datasheets".Page 47Ch
Part3
129 C-Control Pro IDE© 2013 Conrad ElectronicIDE3The C-Control Pro User Interface (IDE) consists of the following main elements:Sidebar for Project Fi
130IDE© 2013 Conrad Electronic3.1 ProjectsEvery program for the C-Control Pro Module is configured through a project. The project states whichsource f
5 C-Control Pro IDE© 2013 Conrad Electronic1.9 HistoryVersion 2.31 from 09/20/2013New FeaturesAVR32 supportEthernet Support (AVR32Bit)Webserver (AVR32
131 C-Control Pro IDE© 2013 Conrad ElectronicIn menu Project the current project can be translated by the Compiler by use of Compile (F9). TheCompiler
132IDE© 2013 Conrad ElectronicProject FilesWhen files have been added to the project these can be opened by a double mouse click onto thefile name. By
133 C-Control Pro IDE© 2013 Conrad Electronic3.1.4 Project Options For each project the compiler settings can be changed separately.The item
134IDE© 2013 Conrad ElectronicCreate Debug CodeCreates Debug Code. If Debug Code is compiled the Byte Code be-comes insignificantly longer. For each l
135 C-Control Pro IDE© 2013 Conrad Electronic Only those files will be used for compilation whose CheckBox has been selected.The list can be alt
136IDE© 2013 Conrad Electronic3.1.7 Todo ListeOn the Project menu a simple todo list can be called. The content is stored together with the pro-ject.3
137 C-Control Pro IDE© 2013 Conrad ElectronicA mouse click in the area to the left of the text will there set a Breakpoint. Prior to this the sourcete
138IDE© 2013 Conrad ElectronicCode FoldingTo maintain a good overview over the source code, the code can be folded. After the syntactical ana-lyzer, t
139 C-Control Pro IDE© 2013 Conrad ElectronicParameter Input HelpNach einer erfolgreichen Kompilierung werden auch die Parameter einer Function analys
140IDE© 2013 Conrad ElectronicSearch/Restore DialogText to find – Input field for the text to be searched for.Replace with – Text that will replace th
6Important Notes© 2013 Conrad ElectronicFloats in tables now workCorrected negative values in tablesFixed constant expressions in parenthesesCorrected
141 C-Control Pro IDE© 2013 Conrad ElectronicPrint: Prints the indicated pagesPrint Preview: Shows a print previewPrinter Setup: Choose the printer,
142IDE© 2013 Conrad ElectronicShift + Right Move cursor and select right one charShift + Up Move cursor and select up one lineShift + Down Move cur
143 C-Control Pro IDE© 2013 Conrad ElectronicCtrl + K + B Marks the beginning of a block Ctrl + K + K Marks the end of a block Esc Reset selection C
144IDE© 2013 Conrad Electronic3.3 C-Control HardwareUnder menu item C-Control all hardware relevant functions can be executed. These include transfera
145 C-Control Pro IDE© 2013 Conrad Electronic3.3.2 Start ProgramProgram TransferAfter a project has been translated free of errors the Bytecode must f
146IDE© 2013 Conrad Electronic You can enter the current network settings, the UDP port of the bootloader and the MAC address. To avoid connecti
147 C-Control Pro IDE© 2013 Conrad Electronic Currently, the Ethernet support is limited to program update. 3.3.5 OutputsFor display of Debug mess
148IDE© 2013 Conrad Electronicseveral Debug Functions.With a right mouse click in the Debug Outputs section the following commands can be selected:Del
149 C-Control Pro IDE© 2013 Conrad Electronic 3.4 DebuggerIn order to activate the Debugger the project must first be compiled in Debug Code free
150IDE© 2013 Conrad Electronic3.4.1 BreakpointsThe editor allows to set up to 16 Breakpoints. A Breakpoint is entered by a mouse click to the left oft
7 C-Control Pro IDE© 2013 Conrad ElectronicAddition und Subtraction of PointersOptimized Port OUT, PIN and DDR AccessDirect Atmel Register AccessForma
151 C-Control Pro IDE© 2013 Conrad Electronic In order to enter a variable into the list of monitored variables there are two possibilities. For on
152IDE© 2013 Conrad ElectronicUnder certain circumstances an error message is shown instead of a value in the list: no Debug Code No Debug Code has be
153 C-Control Pro IDE© 2013 Conrad Electronic The contents of an array window may at every stop of the Debugger or at every single step no longerb
154IDE© 2013 Conrad ElectronicTerminal Window Received characters are directly shown in the terminal window. Characters can be send in two differ-e
155 C-Control Pro IDE© 2013 Conrad Electronic You can change the attributes of the font, and the foreground- and background color. With Multilineb
156IDE© 2013 Conrad ElectronicDefault, Line separator and Sub background are not used. Due to technical limitations, this dialog is always displayed
157 C-Control Pro IDE© 2013 Conrad Electroniconly the selected word is highlighted. Fixed line height - Prevents line height calculation. Line height
158IDE© 2013 Conrad Electronic3.5.3 IDE SettingsSeparate aspects of the IDE can be configured. check for Transfer after Compilation – After a
159 C-Control Pro IDE© 2013 Conrad Electronic3.5.3.1Editor Editor Tabs - Different files are displayed in Editor Tabs.Multiline Editor Tabs - The
160IDE© 2013 Conrad Electronic3.5.3.2Internet UpdateIn order to check if any improvements or error corrections have been issued by Conrad Electronic t
8Important Notes© 2013 Conrad ElectronicNew FTDI driverError CorrectionsGlobal For-Loop counter variables in BASIC work now correctChar variables work
161 C-Control Pro IDE© 2013 Conrad Electronic3.5.3.3Compiler PresettingIn the Compiler Presetting the standard values can be configured which will be
162IDE© 2013 Conrad Electronic 3.5.3.5 ToolsIn the Tool settings the user can insert, delete and edit entries that defines external programs thatc
163 C-Control Pro IDE© 2013 Conrad Electronic For each program that is inserted, the user can choose the name, the execution path and the para-mete
164IDE© 2013 Conrad Electronic3.7 HelpUnder menu item Help the Help file can be opened by use of Contents (Key F1).Menu item Program Version will open
165 C-Control Pro IDE© 2013 Conrad Electronic The command Context Help is also available in the editor window after a right mouse click.
Part4
167 C-Control Pro IDE© 2013 Conrad ElectronicCompiler44.1 General FeaturesThis domain provides information on the Compiler’s properties and features w
168Compiler© 2013 Conrad ElectronicIf there is an optional #else instruction then the source text will be processed after #else if the sym-bol has not
169 C-Control Pro IDE© 2013 Conrad Electronictxt=__LINE__;Msg_WriteText(txt); // Issue Line NumberMsg_WriteChar(13); // LFtxt=__FILE__;Msg_WriteTex
170Compiler© 2013 Conrad ElectronicTotal Length: 4 bytesFunction main()count 2 2n 2
9 C-Control Pro IDE© 2013 Conrad ElectronicThread_Kill() worked erroneous when called from the main threadread accesses from globally defined floating
171 C-Control Pro IDE© 2013 Conrad Electronic4.2.2 InstructionsInstructionAn instruction consists of several reserved command words, identifiers and o
172Compiler© 2013 Conrad ElectronicIdentifierIdentifier are the names of Functions or Variables. Valid characters are letters (A-Z,a-z), numbers (0-9)
173 C-Control Pro IDE© 2013 Conrad ElectronicIn some cases expressions must be constant in order to be valid. E. g. also see Declaration of Ar-ray Var
174Compiler© 2013 Conrad Electroniction is executed "signed".If one of the operands is of the float type then the result is also of the floa
175 C-Control Pro IDE© 2013 Conrad ElectronicFloating Point Figures (data type float) may contain a decimal point and an exponent.float x,y;x=5.70;y=2
176Compiler© 2013 Conrad Electronicbyte glob[10] = {1,2,3,4,5,6,7,8,9,10};flash byte fglob[2][2]={10,11,12,13};void main(void){ byte loc[5]= {2,3,4
177 C-Control Pro IDE© 2013 Conrad ElectronicSequenceChar/Value\\\\''\a7\b8\t9\n10\v11\f12\r13 Strings cannot be assigned to multi dimension
178Compiler© 2013 Conrad Electronic // x,y not accessable since local to function func1}Global variables have a defined memory space which is avail
179 C-Control Pro IDE© 2013 Conrad Electronic4.2.5.1Arithmetic OperatorsAll arithmetic operators with the exception of Modulo are defined for Integer
180Compiler© 2013 Conrad Electronic16 >> 244.2.5.4 In- /Decrement OperatorsIncremental and decremental operators are only allowed for variables
10Important Notes© 2013 Conrad ElectronicVersion 1.39 from 06/09/2005New FeaturesBASIC SupportCompactC and BASIC can be mixed in a projectExtended Doc
181 C-Control Pro IDE© 2013 Conrad Electronic&& logical And1 && 15 && 010|| logical Or0 || 01 || 001! logical Not!2!0014.2.6 C
182Compiler© 2013 Conrad Electronic{ a=a*2; x=a;} while(a); The essential difference between the do .. while loop and the normal while loop is t
183 C-Control Pro IDE© 2013 Conrad ElectronicIf a loop needs to be programmed with a different step width Instruction2 needs to be modified ac-cording
184Compiler© 2013 Conrad Electronic4.2.6.5if .. elseAn if instruction does have the following syntax:if( Expression ) Instruction1;else Instruction2;A
185 C-Control Pro IDE© 2013 Conrad Electronic case constant_2: Instruction_2; break; . . case constant_n: Instruction_n;
186Compiler© 2013 Conrad Electronic case 2: a++; // is also executed at a value of a==1 case 3: a++; // is also executed at a val
187 C-Control Pro IDE© 2013 Conrad Electronic4.2.7 FunctionsIn order to structure a larger program it is separated into several sub-functions.This not
188Compiler© 2013 Conrad Electronic} When calling up a function all parameters must always be stated. The following call up is inad-missible: func1()
189 C-Control Pro IDE© 2013 Conrad Electronicis only the reference (pointer) to the array variable text. Presently arrays can only be passed "by
190Compiler© 2013 Conrad Electronic10 + -9 << >>8 < <= > >=7 == !=6 &5 ^4 |3 &&2
C-Control Pro IDEI© 2013 Conrad ElectronicTable of ContentsPart 1Important Notes2...
Part2
191 C-Control Pro IDE© 2013 Conrad Electronic! logisches Nicht Bitoperatoren& Und| Oder^ exclusives Oder~ Bitinvertierung4.2.8.3 Reserved Wo
192Compiler© 2013 Conrad Electronic4.3 BASICThe second programming language for the C-Control Pro Mega Module is BASIC. The Compilertranslates
193 C-Control Pro IDE© 2013 Conrad Electronic4.3.2 InstructionsInstructionAn instruction consists of several reserved command words, identifiers and o
194Compiler© 2013 Conrad Electronic Arithmetic ExpressionsAn arithmetic expression is a quantity of values connected by Operators. In this case quant
195 C-Control Pro IDE© 2013 Conrad ElectronicData TypeSignRangeBit CharYes-128 ... +1278 ByteNo0 ... 2558 IntegerYes-32768 ... +3276716 UIntegerNo0 ..
196Compiler© 2013 Conrad ElectronicDim Name1, Name2, Name3 As IntegerAs types are allowed: Char, Byte, Integer, Word, SingleExamples:Dim a As IntegerD
197 C-Control Pro IDE© 2013 Conrad ElectronicDim f As Singles=SizeOf(f) ' the value of s is 4 With arrays only the Byte length of the basic data
198Compiler© 2013 Conrad ElectronicDirect Access to flash Array entriesWith version 2.12 it is possible to access single entries in flash arrays:Flash
199 C-Control Pro IDE© 2013 Conrad ElectronicDim str_array(3,40) As CharDim Single_str(40) As CharSingle_str="A String"' will copy Sing
200Compiler© 2013 Conrad ElectronicSub func1() Static a As IntegerEnd SubIn opposition to normal local variables will static variables still keep t
12Hardware© 2013 Conrad ElectronicHardware2This chapter gives a description of the hardware coming into operation with the C-Control Pro series.The Mo
201 C-Control Pro IDE© 2013 Conrad Electronic- Negative Sign-(2+2)-44.3.5.2 BitoperatorsBit operators are only allowed for Integer data typesOperator
202Compiler© 2013 Conrad ElectronicOperator DescriptionExampleResultvariable++ first variable value, after access variable gets incremented by one (p
203 C-Control Pro IDE© 2013 Conrad ElectronicDo InstructionsLoop While ExpressionThe instructions are being executed. At the end the Expression is
204Compiler© 2013 Conrad Electronic Do While a<10 a=a+2End WhileDo While a a=a*2 x=aEnd WhileExit InstructionIf an Exit instruction is ex
205 C-Control Pro IDE© 2013 Conrad ElectronicFor i=1 To 10 Step 3 'Increment i in steps of 3 If i>3 Then a=i End If a=a-1Ne
206Compiler© 2013 Conrad Electronic Instructions2Else Instructions3End IfAfter the if instruction an Arithmetic Expression will follow. If th
207 C-Control Pro IDE© 2013 Conrad ElectronicEnd CaseThe value of the Expression is calculated. Then the program execution will jump to the first cons
208Compiler© 2013 Conrad Electronic Case >= 100 b=14 Case <> 25 b=15 Else b=b+2End Case In CompactC the instruc
209 C-Control Pro IDE© 2013 Conrad Electronic Sub main() Dim a As Word Dim f As Single func1(128,12.0) ' you can pass Numerical constan
210Compiler© 2013 Conrad Electronic Text="hello world" Len=StringLength(Text)End SubIn main the reference of text is presented as para
13 C-Control Pro IDE© 2013 Conrad Electroniction Board Mounting Orientation of Module MEGA32 The connector of Module Mega32 has been designed in such
211 C-Control Pro IDE© 2013 Conrad Electronic4.3.8.1Operator PrecedenceRank Operator10 ( )9 - (negative sign)8 * / 7 Mod6 + -5 <
212Compiler© 2013 Conrad ElectronicXor exclusive OrNot Bit inversion4.3.8.3 Reserved WordsThe following words are reserved and cannot be used as ide
213 C-Control Pro IDE© 2013 Conrad Electronic// CompactC Sourcevoid proc1 $asm("tag1")(void);int proc2 $asm("tag2")(int a, float b
214Compiler© 2013 Conrad Electronic CLR R30 ; the high byte is zero ST X,R30 ret.endifIn the second part of the assembler source
215 C-Control Pro IDE© 2013 Conrad ElectronicWhen the address of the global variable is in the X register pair (R26,R27), the desired value (in ourexa
216Compiler© 2013 Conrad Electronicdone to save bytecodes in the interpreter. Is the assembly routine declared as byte, a word mustbe a written as the
217 C-Control Pro IDE© 2013 Conrad Electronic4.5 ASCII TableASCII TableCHARDECHEXBINDescriptionNUL00000000000000Null CharacterSOH00100100000001Start o
218Compiler© 2013 Conrad ElectronicSUB02601A00011010SubstituteESC02701B00011011EscapeFS02801C00011100File SeparatorGS02901D00011101Group SeparatorRS03
219 C-Control Pro IDE© 2013 Conrad Electronic605403600110110705503700110111805603800111000905703900111001:05803A00111010Colon;05903B00111011Semi-Colon
220Compiler© 2013 Conrad ElectronicU08505501010101V08605601010110W08705701010111X08805801011000Y08905901011001Z09005A01011010[09105B01011011Left Openi
14Hardware© 2013 Conrad ElectronicFrom here select "Install software from a list or other source" and click "Next"..
221 C-Control Pro IDE© 2013 Conrad Electronicq11307101110001r11407201110010s11507301110011t 11607401110100u11707501110101v11807601110110w1190770111011
223 C-Control Pro IDE© 2013 Conrad ElectronicLibraries5In this part of the documentation all attached Help functions are described which allow the use
224Libraries© 2013 Conrad ElectronicParameterms wait duration in milliseconds5.2.2 ForceBootloader (AVR32Bit)General FunctionsSyntaxvoid ForceBootlo
225 C-Control Pro IDE© 2013 Conrad Electronic001ADC Noise Reduction010Power-down011Power-save100Reserved101Reserved110Standby111Extended Standby5.3 An
226Libraries© 2013 Conrad Electronic// Mega32: Input (+) PB2 (PortB.2) bzw. band gap reference 1,22V// Input (-) PB3 (PortB.3)// Mega128: In
227 C-Control Pro IDE© 2013 Conrad Electronic5.3.2.1AC_DisableAnalog Compare Functions ExampleSyntaxvoid AC_Disable(byte ctrl);Sub AC_Disable(ctrl As
228Libraries© 2013 Conrad ElectronicAC_AC0AN0P201in_neg-AC_AC0BP0P212in_neg-AC_AC1AP0P250-in_posAC_AC1AP1P111-in_posAC_AC1AN0P242-in_negAC_AC1AN1P123-
229 C-Control Pro IDE© 2013 Conrad Electronic5.4 Analog-Digital-Converter5.4.1 MegaThe Micro Controller has an Analog Digital Converter with a resolu
230Libraries© 2013 Conrad Electronicu = x * Reference Voltage / 512 / V5.4.1.1 ADC_DisableADC FunctionsSyntaxvoid ADC_Disable(void);Sub ADC_Disable()D
15 C-Control Pro IDE© 2013 Conrad ElectronicThen type in the path to the driver’s directory. If the software has been installed to "C:\Programs&q
231 C-Control Pro IDE© 2013 Conrad ElectronicSub ADC_ReadInt() As WordDescriptionThis function is used to read the measurement value after a successfu
232Libraries© 2013 Conrad Electronic5.4.1.5ADC_SetIntADC FunctionsSyntaxword ADC_SetInt(byte v_ref, byte channel);Sub ADC_SetInt(v_ref As Byte, channe
233 C-Control Pro IDE© 2013 Conrad Electronic5.4.2 AVR32BitThe microcontroller has an Analog-to-Digital converter with a selectable resolution of 8/
234Libraries© 2013 Conrad Electronicoffset);Sub ADC_Enable(mode As Byte, speed As ULong, ref As Byte, input_cnt AsByte, offset As Char)Descri
235 C-Control Pro IDE© 2013 Conrad ElectronicADC_REF06VDDinternal 0.6 x VDDANA ReferenceADC_ADCREF0external ADCREF0 ReferenceADC_ADCREF1external ADCRE
236Libraries© 2013 Conrad Electronicvalues pointer to the 16-Bit array (0-7)cnt number of values that are copied into the array5.4.2.5 ADC_SetInputA
237 C-Control Pro IDE© 2013 Conrad ElectronicSub ADC_Start()DescriptionThe built-in A / D converter starts to convert analog data.ParameterNone5.4.2.7
238Libraries© 2013 Conrad Electroniconly used today in the automotive industry, but also in the areas of automation, aviation, aerospaceand medical te
239 C-Control Pro IDE© 2013 Conrad ElectronicLess than 125 kbit/sUp to 1000mThe line lengths are highly dependent on the used cables and the number of
240Libraries© 2013 Conrad Electronic5.5.1 CAN ExamplesIn this chapter some initialization examples are given to clarify the operation of the CAN Libra
16Hardware© 2013 Conrad ElectronicThe message "C-Control Pro USB Device has not passed the Windows Logo Test ..." will normallyappear. Thi
241 C-Control Pro IDE© 2013 Conrad Electronicbyte data[8], i;for(i=0;i<8;i++) data[i]=i;CAN_SetMOb(1, 0x12345678, 0, CAN_SEND|CAN_EXTID);CAN_MObSen
242Libraries© 2013 Conrad ElectronicReturns information about the number of received CAN messages and CAN transmission errors.Parameter infotype sele
243 C-Control Pro IDE© 2013 Conrad Electronic0CAN_10KBPS10.000bps1CAN_20KBPS20.000bps2CAN_40KBPS40.000bps3CAN_100KBPS100.000bps4CAN_125KBPS125.000bps5
244Libraries© 2013 Conrad ElectronicDescriptionA CAN message is sent over the bus. If, however, the CAN_REPL flag was set at CAN_SetMOb (), the datafo
245 C-Control Pro IDE© 2013 Conrad ElectronicParameter mob MOb Number(0-14)ID IdentifiermaskID Identifier Maskflag Operation parameter for the Mes
246Libraries© 2013 Conrad ElectronicDescriptionAll Date and Time values of the internal software clock can be read. The values of day and month are z
247 C-Control Pro IDE© 2013 Conrad Electronic5.6.3 Clock_SetTimeClock FunctionsSyntaxvoid Clock_SetTime(byte hour, byte min, byte sec, char corr);Sub
248Libraries© 2013 Conrad Electronic28Parity Minute29 - 34Hour35Parity Hour36 - 41Day of the Month42 - 44Weekday45 - 49Month50 - 57Year58Parity DateTh
249 C-Control Pro IDE© 2013 Conrad ElectronicRTC (Real Time Clock)The RTC is controlled by a 10ms interrupt and runs in the background independent of
250Libraries© 2013 Conrad Electronic5.7.3 DCF_PULSDCF Functions Syntaxvoid DCF_PULS(void);Sub DCF_PULS()DescriptionSet DCF_Mode to 1 ("look for
17 C-Control Pro IDE© 2013 Conrad ElectronicSPI Switch Off (only Mega128)A signal on the SPI interface during switch on can activate USB communicatio
251 C-Control Pro IDE© 2013 Conrad Electronicvoid DCF_SYNC(void);Sub DCF_SYNC()DescriptionSet DCF_Mode to 2 ("synchronize for frame beginning&quo
252Libraries© 2013 Conrad ElectronicSub Msg_WriteFloat(val As Single)DescriptionThe passed floating point number is displayed with a preceding decimal
253 C-Control Pro IDE© 2013 Conrad Electronicval 16bit integer value5.8.5 Msg_WriteTextDebug Message FunctionsSyntaxvoid Msg_WriteText(char text[]);
254Libraries© 2013 Conrad Electronictions!5.9.1 DirAcc_ReadDirect Access FunctionsSyntaxbyte DirAcc_Read(byte register);Sub DirAcc_Read(register As By
255 C-Control Pro IDE© 2013 Conrad Electronic5.10.1 EEPROM_ReadEEPROM FunctionsSyntaxbyte EEPROM_Read(word pos);Sub EEPROM_Read(pos As Word) As ByteDe
256Libraries© 2013 Conrad Electronic5.10.3 EEPROM_ReadFloatEEPROM FunctionsSyntaxfloat EEPROM_ReadFloat(word pos);Sub EEPROM_ReadFloat(pos As Word) As
257 C-Control Pro IDE© 2013 Conrad Electronic5.10.5 EEPROM_WriteWordEEPROM FunctionsSyntaxvoid EEPROM_WriteWord(word pos, word val);Sub EEPROM_WriteWo
258Libraries© 2013 Conrad Electronic5.11 Ethernet (AVR32Bit)The C-Control Pro Unit AVR32Bit supports Ethernet hardware and protocols that follo
259 C-Control Pro IDE© 2013 Conrad Electronicton to initiate a complete system reboot.5.11.2 TCP/IP ProgrammingOpen a TCP/IP connection:Create a recei
260Libraries© 2013 Conrad Electronicbyte tcp_buf[ETH_BUF(4000,6)], rbuf[1461];void main(void){ word info[4], plen; char cmdtxt[50]; dword ip;
18Hardware© 2013 Conrad Electronicmeans that measured voltages can be represented by integral numbers from 0 through 1023. The ref-erence voltage for
261 C-Control Pro IDE© 2013 Conrad Electronic char text[10]; ETH_SetConnBuf(tcp_buf, 4000, 6); // 4000 byte buffer and allow 6 connections E
262Libraries© 2013 Conrad Electronicvoid SendSyslogMsg(dword ip, byte level, char text[]){ byte buf[100]; Str_Printf(buf, "<%d>%s&quo
263 C-Control Pro IDE© 2013 Conrad ElectronicDescriptionOpens a TCP / IP connection to a port. The 32-bit value of the IP address can be calculated wi
264Libraries© 2013 Conrad Electronicinfo[0]socket indexinfo[1]IP port of senderinfo[2]socket handleinfo[3]packet length5.11.6 ETH_CloseListenTCPEthern
265 C-Control Pro IDE© 2013 Conrad ElectronicSub ETH_DisconnectTCP(sock_id As Byte)DescriptionTerminates an open connection.Parameter sock_id Socket
266Libraries© 2013 Conrad ElectronicDescriptionInforms about the status of the connection. Since the other party can cancel a TCP / IP connection at
267 C-Control Pro IDE© 2013 Conrad Electronic5.11.12 ETH_ListenUDPEthernet FunctionsSyntaxword ETH_ListenUDP(word port);Sub ETH_ListenUDP(port As Word
268Libraries© 2013 Conrad ElectronicSub ETH_SendTCP(sock_id As Byte, ByRef buf As Byte, len As Word) As ByteDescriptionSends TCP data to an open TCP/I
269 C-Control Pro IDE© 2013 Conrad ElectronicSub ETH_SetConnBuf(ByRef buf As Byte, size As Word, TCP_conn As Byte)DescriptionCreates an Ethernet recei
270Libraries© 2013 Conrad Electronic The Bitrate can be calculated as follows: Bitrate = ((CPU_CLOCK / TARGET_I2C_SPEED) - 16) / 25.12.1.2 I2C_Read_A
19 C-Control Pro IDE© 2013 Conrad Electronic It is important to closely study the pin assignment of M32 and M128 prior to programming sinceimportant f
271 C-Control Pro IDE© 2013 Conrad ElectronicDescriptionThis function introduces communication with a starting sequence. Afterwards the status o
272Libraries© 2013 Conrad Electronic5.12.1.7 I2C_WriteI2C Functions ExampleSyntaxvoid I2C_Write(byte data);Sub I2C_Write(data As Byte)DescriptionI2C_W
273 C-Control Pro IDE© 2013 Conrad Electronic40 SLA+R has been sent, ACK has been received48 SLA+R has been sent, NACK has been received50 Data byte h
274Libraries© 2013 Conrad Electronic5.12.2.1I2C_ProbeI2C FunctionsSyntaxbyte I2C_Probe(byte addr);Sub I2C_Probe(addr As Byte) As ByteDescriptionI2C_Pr
275 C-Control Pro IDE© 2013 Conrad Electroniclength number of bytes that are transferred (exclusive header)Return Parameter-1 = transmission error0
276Libraries© 2013 Conrad ElectronicSub I2C_Write(addr As Byte, hdr As ULong, hdr_len As Byte, ByRef mem_addr As Byte, length As Word) As
277 C-Control Pro IDE© 2013 Conrad Electronic5.13 InterruptThe Controller provides a multitude of interrupts. Some of them are used for system functi
278Libraries© 2013 Conrad Electronic INT_4 external Interrupt 4 INT_5 external Interrupt 5 INT_6 external Interrupt 6 INT_7 external Interrupt 7 INT_
279 C-Control Pro IDE© 2013 Conrad Electronic0: a falling edge triggers the interrupt1: a rising edge triggers the interruptMode parameter for AVR32
280Libraries© 2013 Conrad ElectronicThe return value expresses how often a interrupt got triggered until the function Irq_GetCount() has beencalled.
20Hardware© 2013 Conrad ElectronicEnvironmental ConditionsRange of admissable ambient temperature 0°C … 70°C Range of admissable ambient relative humi
281 C-Control Pro IDE© 2013 Conrad Electronicint cnt;void ISR(void){ cnt=cnt+1;#if AVR32 Irq_GetCount(INT_100HZ);#else Irq_GetCount(INT_TIM2C
282Libraries© 2013 Conrad ElectronicParameterNone5.14.2 Key_ScanKeyboard FunctionsSyntaxword Key_Scan(void);Sub Key_Scan() As WordDescriptionKey_Scan
283 C-Control Pro IDE© 2013 Conrad Electronic5.15 LCDA part of these routines is implemented in the Interpreter, another part can be called up by appe
284Libraries© 2013 Conrad ElectronicNone5.15.1.3 LCD_WriteDataRegisterLCD Functions (Library "LCD_Lib.cc")Syntaxvoid LCD_WriteDataRegister(c
285 C-Control Pro IDE© 2013 Conrad ElectronicDescriptionClears the display and enables the Cursor.Parameter None5.15.3 LCD_CursorOffLCD Functions (Lib
286Libraries© 2013 Conrad Electronic5.15.5 LCD_CursorPosLCD Functions (Library "LCD_Lib.cc")Syntaxvoid LCD_CursorPos(byte pos);Sub LCD_Curso
287 C-Control Pro IDE© 2013 Conrad ElectronicNone5.15.7 LCD_LocateLCD FunctionsSyntaxvoid LCD_Locate(int row, int column);Sub LCD_Locate(row As Intege
288Libraries© 2013 Conrad Electronic5.15.9 LCD_WriteCharLCD Functions (Library "LCD_Lib.cc")Syntaxvoid LCD_WriteChar(char c);Sub LCD_WriteCh
289 C-Control Pro IDE© 2013 Conrad ElectronicDescriptionLCD_WriteRegister divides the data byte y in 2 nibbles (4bit values) andsends the nibbles to t
290Libraries© 2013 Conrad Electronic5.16 MathMathematical Functions.5.16.1 Floating PointIn the following the mathematical functions are listed which
IIInhalt© 2013 Conrad Electronic...
21 C-Control Pro IDE© 2013 Conrad Electronic32K Bytes of In-System Self-Programmable FlashEndurance: 10,000 Write/Erase CyclesIn-System Programming by
291 C-Control Pro IDE© 2013 Conrad ElectronicDescriptionThe mathematical arc sine (inverse sine) is calculated. Parameter val input value between -1
292Libraries© 2013 Conrad ElectronicReturn Parameterresult5.16.1.6 cosFloating Point FunctionsSyntaxfloat cos(float val);Sub cos(val As Single) As Sin
293 C-Control Pro IDE© 2013 Conrad Electronic5.16.1.8fabsFloating Point FunctionsSyntaxfloat fabs(float val);Sub fabs(val As Single) As SingleDescript
294Libraries© 2013 Conrad ElectronicSub ldexp(val As Single,expn As Integer) As SingleDescriptionThe function val * 2 ^ expn is calculated (also used
295 C-Control Pro IDE© 2013 Conrad ElectronicThe logarithm base 10 is calculated.Parameter val input valueReturn Parameterresult5.16.1.13 powFloatin
296Libraries© 2013 Conrad Electronicresult of the function5.16.1.15 sinFloating Point FunctionsSyntaxfloat sin(float val);Sub sin(val As Single) As Si
297 C-Control Pro IDE© 2013 Conrad Electronic5.16.1.17tanFloating Point FunctionsSyntaxfloat tan(float val);Sub tan(val As Single) As SingleDescriptio
298Libraries© 2013 Conrad Electronic5.16.2.2srandInteger FunctionsSyntaxvoid srand(int seed);Sub srand(seed As Integer)DescriptionSets the seed for th
299 C-Control Pro IDE© 2013 Conrad Electronic5.17.2 Onewire_Reset1-Wire FunctionsSyntaxvoid Onewire_Reset(byte portbit);Sub Onewire_Reset(portbit As B
300Libraries© 2013 Conrad Electronic ret= OneWire_Reset(7); // PortA.7 if(ret == 0) { text= "no device found"; Msg_Wr
22Hardware© 2013 Conrad Electronic20PD6PortD.630ICPLED1LED; Input Capture Pin for Pulse/Period Measurement21PD7PortD.731LED2LED22PC0PortC.016SCLEXT-SC
301 C-Control Pro IDE© 2013 Conrad Electronic End If OneWire_Write(0xcc) ' skip ROM cmd OneWire_Write(0x44) ' start temperature
302Libraries© 2013 Conrad Electronicinput then the pull-up resistor (Reference Level VCC) is activated and the input is defined.Atmel AVR32BitThe Atme
303 C-Control Pro IDE© 2013 Conrad Electronicset PullDownPORT_ATTR_PULL_DOWN08minimum Drive StrengthPORT_ATTR_DRIVE_MIN00normal Drive StrengthPORT_ATT
304Libraries© 2013 Conrad Electronic Port Bit access is always significant slower than the normal Port access that transfers 8 Bit. If the de-sired
305 C-Control Pro IDE© 2013 Conrad ElectronicParameter portbit bit number of port (see Port Table)Return Parameterbit value (0 or 1)5.18.6 Port_Togg
306Libraries© 2013 Conrad Electronicport port number (see Port Table)5.18.8 Port_Write (Mega)Port Functions ExampleSyntaxvoid Port_Write(byte port, b
307 C-Control Pro IDE© 2013 Conrad Electronicted.Parameter portbit bit number of port (see Port Table)val bit value (0 or 1)5.18.10 Port TablePort N
308Libraries© 2013 Conrad ElectronicPortbits Table AVR32DefinitionPortbitPortbit NamePortA.00PA00...PortA.3131PA31PortB.032PB00...PortB.31
309 C-Control Pro IDE© 2013 Conrad ElectronicPort2852PB20Port2953PB21Port3054PB22Port3155PB23Port3265PC01Port3370PC06Port3468PC04Port3569PC05Port3681P
310Libraries© 2013 Conrad Electronic5.18.12 Port Example (AVR32Bit)All three program examples will light LED1 as long as button T1 is pressed. The exa
23 C-Control Pro IDE© 2013 Conrad Electronic2.1.3.3Connection Diagram11223344D DC CB BA ATitleNumber RevisionSizeA4Date: 05.08.2004 Sheet of File:
311 C-Control Pro IDE© 2013 Conrad Electronicvoid main(void){ Port_Attribute(PC23, PORT_ATTR_OUTPUT | PORT_ATTR_INIT_LOW); Port_Attribute(PC20,
312Libraries© 2013 Conrad ElectronicConnection to C-Control Pro (Sender diode)Connection to C-Control Pro (Receiver)Pin assignment of TSOP1736 IR-Rece
313 C-Control Pro IDE© 2013 Conrad ElectronicInternal struture of receiver
314Libraries© 2013 Conrad ElectronicExternal circuit of receiver for connection to C-Control Pro5.19.1 RC5_InitRC5 FunctionsSyntaxvoid RC5_Init(byte p
315 C-Control Pro IDE© 2013 Conrad ElectronicParameter pin bit number of port (see Port Table)5.19.2 RC5_ReadRC5 FunctionsSyntaxword RC5_Read(void);S
316Libraries© 2013 Conrad Electronic5.20 RS232 There is a chance to miss received characters when using the polled serial routines, especiallyat high
317 C-Control Pro IDE© 2013 Conrad Electronicdivider = ( processor clock / baudrate / 16 ) -1Example: 15 = (14745600 / 57600 / 16 ) -1 It is difficul
318Libraries© 2013 Conrad Electronic31SR_BDMIDI31250bps25SR_BD3840038400bps8022 (Hex)SR_BD5760057600bps12SR_BD7680076800bps6SR_BD125000125000bps3SR_BD
319 C-Control Pro IDE© 2013 Conrad Electronicbaudrate. This has the advantage that baudrates, that have no exact divider value can be represented. E.g
320Libraries© 2013 Conrad Electronicserport interface number (0 = 1st serial port, 1 = 2nd serial port, ...)par interface parameter (see par table)b
24Hardware© 2013 Conrad Electronicresponding socket strips must be organized in the following pitch format: In the graph the socket strip X1-X4 a
321 C-Control Pro IDE© 2013 Conrad Electronic Please use Serial_ReadExt() if you work in serial IRQ mode. Serial_Read() only supports polle
322Libraries© 2013 Conrad ElectronicSR_EVEN_PAR" means 7 bit character length, 2 stop bits and even parity (see Example). An example inBASIC Syn
323 C-Control Pro IDE© 2013 Conrad ElectronicParameter serport interface number (0 = 1st serial port, 1 = 2nd serial port )info values:RS232_FIFO_R
324Libraries© 2013 Conrad ElectronicDescriptionReads one byte from the serial interface. In opposite to Serial_Read() Serial_ReadExt() returns imm
325 C-Control Pro IDE© 2013 Conrad ElectronicParameter serport interface number (0 = 1st serial port, 1 = 2nd serial port )text char array5.20.12
326Libraries© 2013 Conrad Electronictriggered. In the demo programs this part is commented out for the AVR32Bit Unit.SD-Card Support for C-Control Pro
327 C-Control Pro IDE© 2013 Conrad ElectronicLEDPB.7EN2PB.6 WP (Write Protect):high = write protected SD cardlow = access allowedCD (Card Detect):hig
328Libraries© 2013 Conrad Electronic5.21.1 FAT SupportFAT SpecificationFAT support: FAT12, FAT16 and FAT32.Open files: Unlimited, depending on availab
329 C-Control Pro IDE© 2013 Conrad ElectronicDescriptionCloses a previously opened file.Parameter fil_ramaddr address of the FILE bufferReturn Param
330Libraries© 2013 Conrad ElectronicModeValue (Hex)DescriptionFA_OPEN_EXISTING00 Opens file. If file does not exist, then errorFA_READ01 File readin
25 C-Control Pro IDE© 2013 Conrad ElectronicClock GenerationClock generation takes place by a 14.7456MHz Quartz Oscillator. All time dependent actions
331 C-Control Pro IDE© 2013 Conrad ElectronicParameter fil_ramaddr address of the FILE bufferpos read / write positionReturn ParameterSuccess of t
332Libraries© 2013 Conrad ElectronicRead attributes of a file to a dword (ULong) array with 4 elements.Parameter path file pathfilinfo return arrayR
333 C-Control Pro IDE© 2013 Conrad ElectronicReturn ParameterSuccess of the called SDC function. See SDC Return Values.5.21.10 SDC_FTruncateSDCard Fun
334Libraries© 2013 Conrad ElectronicReturn ParameterSuccess of the called SDC function. See SDC Return Values.5.21.12 SDC_GetFreeSDCard FunctionsSynta
335 C-Control Pro IDE© 2013 Conrad ElectronicReturn ParameterSuccess of the called SDC function. See SDC Return Values.5.21.14 SDC_MkDirSDCard Functio
336Libraries© 2013 Conrad ElectronicReturn ParameterSuccess of the called SDC function. See SDC Return Values.5.21.16 SDC_UnlinkSDCard FunctionsSyntax
337 C-Control Pro IDE© 2013 Conrad Electronic // Power on -> SD-Card Port_WriteBit(14,1); // EN2 (PB.6) +5V AbsDelay(50);
338Libraries© 2013 Conrad Electronic+5Volt ist the supply voltage of the servo, it must provide enough current to drive the servo. Theground
339 C-Control Pro IDE© 2013 Conrad Electronic A 16-bit Timer is needed for the servo steering routines. Is the timer turned off, or is used for other
340Libraries© 2013 Conrad Electronic AbsDelay(5000); Servo_Set(7, 1000); // Servo Portbit 7 1000µs AbsDelay(5000); Servo_Set(7, 0);
26Hardware© 2013 Conrad ElectronicTimer_3 with 16 bits each. They can be used for D/A conversion, to control servo motors in patternmaking and to outp
341 C-Control Pro IDE© 2013 Conrad Electronic5.23.1.2SPI_EnableSPI FunctionsSyntaxvoid SPI_Enable(byte ctrl);Sub SPI_Enable(ctrl As Byte)DescriptionTh
342Libraries© 2013 Conrad ElectronicReturn Parameterreceived byte from the SPI interface5.23.1.4 SPI_ReadBufSPI FunctionsSyntaxvoid SPI_ReadBuf(byte b
343 C-Control Pro IDE© 2013 Conrad ElectronicSub SPI_WriteBuf(ByRef buf As Byte, length As Word)Description A number of bytes are sent to the SPI inte
344Libraries© 2013 Conrad Electronicselected that meets the desired clock rate closest: divider = 66Mhz / speed. The actual speed is then66
345 C-Control Pro IDE© 2013 Conrad Electronicless of whether the SPI interface is initialized with more bits.Parameter buf pointer to byte arraylengt
346Libraries© 2013 Conrad ElectronicSub SPI_WriteBuf(ByRef buf As Byte, length As Word)Description A number of bytes are sent to the SPI interface. Th
347 C-Control Pro IDE© 2013 Conrad ElectronicRemark The attribute smaller or greater is specified for the character difference at the first point of d
348Libraries© 2013 Conrad Electronic5.24.4 Str_IsalnumString Functions (Library "String_Lib.cc")Syntaxbyte Str_Isalnum(char c);Sub Str_Isaln
349 C-Control Pro IDE© 2013 Conrad Electronic5.24.6 Str_LenString FunctionsSyntaxword Str_Len(char str[]);Sub Str_Len(ByRef str As Char) As WordDescri
350Libraries© 2013 Conrad Electronic 0 padd with "0" l 32-Bit Integer Format Description %[width]d integer %[width][.prec]u unsign
27 C-Control Pro IDE© 2013 Conrad ElectronicPorts Max. admissible current from digital ports± 20 mAAdmissible current total on digital ports200mAAdmis
351 C-Control Pro IDE© 2013 Conrad ElectronicDescriptionThe value of a string representing an integer number is returned. The number is recognized, ev
352Libraries© 2013 Conrad Electronicis returned.Parameter source string that is searchedsearch substring that is looked forReturn Parameterpositio
353 C-Control Pro IDE© 2013 Conrad Electronicset of offset. The offset parameter is used to change a string after a specified number (offset) of chara
354Libraries© 2013 Conrad Electronic5.24.15 Str_Printf Example// CompactCvoid main(void){ char str[80]; // Integer Str_Printf(str, "arg1
355 C-Control Pro IDE© 2013 Conrad Electronicactive at all times even if no threads have explicitly been started. If the main program (thread "0
356Libraries© 2013 Conrad Electronictions Thread_Wait and Thread_Signal.A thread bound to wait will execute instruction Thread_Wait with a signal numb
357 C-Control Pro IDE© 2013 Conrad Electronic5.25.2 Thread_DelayThread Functions ExampleSyntaxvoid Thread_Delay(word delay);Sub Thread_Delay(delay As
358Libraries© 2013 Conrad Electronic5.25.4 Thread_KillThread FunctionsSyntaxvoid Thread_Kill(byte thread);Sub Thread_Kill(thread As Byte)DescriptionTe
359 C-Control Pro IDE© 2013 Conrad ElectronicDescriptionReturns the free memory that is available for the calling thread.Parameter NoneReturn Paramete
360Libraries© 2013 Conrad ElectronicParameter signal signal value5.25.9 Thread_StartThread Functions ExampleSyntaxvoid Thread_Start(byte thread, dwo
28Hardware© 2013 Conrad Electronic7 Differential Channels2 Differential Channels with Programmable Gain at 1x, 10x, or 200xByte-oriented Two-wire Seri
361 C-Control Pro IDE© 2013 Conrad Electronic5.25.11 Thread Example// demo program of multithreading// this program makes no debouncing, therefore a s
362Libraries© 2013 Conrad Electronic} // after that the thread // sleeps for 20
363 C-Control Pro IDE© 2013 Conrad Electronic// Example: Pulse Counting with CNT1Timer_T1CNT();pulse(n); // generate n Pulsescount=Timer_
364Libraries© 2013 Conrad ElectronicTimer_T3FRQX(10,2,PS_8);5.26.1.3 Frequency MeasurementTimer_1 (16Bit) and Timer_3 (16Bit) (only Mega128) can be us
365 C-Control Pro IDE© 2013 Conrad Electronic Timer_T1PWMX(255,128,128,PS_8); Timer_T1PWA(128); Timer_T1PWB(128); AbsD
366Libraries© 2013 Conrad Electronic while(PM_Value==0); // Measure Pulse Width or Period Msg_WriteHex(PM_Value); // Output Measuring Value}
367 C-Control Pro IDE© 2013 Conrad ElectronicDescriptionThis function disables the specified timer. Timer functions occupy I/O ports. If a timer is
368Libraries© 2013 Conrad Electronicperiod period durationPS prescalerTable prescaler:Prescaler Tickduration Mega32PS0_1 (1) 135,6 ns PS0_8 (2) 1,08
369 C-Control Pro IDE© 2013 Conrad Electronicvoid Timer_T0PW(byte PW);Sub Timer_T0PW(PW As Byte)DescriptionThis function sets a new pulse width for Ti
370Libraries© 2013 Conrad ElectronicPS0_1 (1) 67,8 ns 62,5 ns PS0_8 (2) 542,5 ns500 ns PS0_32 (3) 2,17 µs 2 µs PS0_64 (4) 4,34 µs4 µs PS0_128 (5) 8,68
29 C-Control Pro IDE© 2013 Conrad ElectronicX2_619PG4652TOSC1LED2LEDX2_320RESETX4_1021VCCX4_1222GND23XTAL2Oscillator24XTAL1OscillatorX2_925PD0324INT0S
371 C-Control Pro IDE© 2013 Conrad Electronic5.26.1.15Timer_T0TimeTimer FunctionsSyntaxvoid Timer_T0Time(byte Time, byte PS);Sub Timer_T0Time(Time As
372Libraries© 2013 Conrad ElectronicDescriptionThese function initializes Counter1. Counter1 gets incremented at every positive signal edge
373 C-Control Pro IDE© 2013 Conrad Electronicperiod period durationPS prescalerTable prescaler:Prescaler Tickduration Mega32 + Mega128 Tickduration
374Libraries© 2013 Conrad ElectronicReturn Parametercounter value5.26.1.21 Timer_T1GetPMTimer FunctionsSyntaxword Timer_T1GetPM(void);Sub Timer_T1GetP
375 C-Control Pro IDE© 2013 Conrad Electronic5.26.1.23Timer_T1PMTimer FunctionsSyntaxvoid Timer_T1PM(byte Mode, byte PS);void Timer_T1PM(Mode As Byte,
376Libraries© 2013 Conrad Electronic5.26.1.25Timer_T1PWMTimer FunctionsSyntaxvoid Timer_T1PWM(word period, word PW0, byte PS);Sub Timer_T1PWM(period A
377 C-Control Pro IDE© 2013 Conrad ElectronicParameterperiod period durationPW0 pulse width channel APW1 pulse width channel BPS prescaler (
378Libraries© 2013 Conrad ElectronicParameter prescaler prescaler (see table)5.26.1.29 Timer_T1StopTimer FunctionsSyntaxvoid Timer_T1Stop(void);Sub
379 C-Control Pro IDE© 2013 Conrad ElectronicPS_1 (1) 67,8 ns 62,5 ns PS_8 (2) 542,5 ns500 ns PS_64 (3) 4,34 µs4 µs PS_256 (4) 17,36 µs 16 µs PS_1024
380Libraries© 2013 Conrad Electronic5.26.1.33Timer_T3FRQTimer FunctionsSyntaxvoid Timer_T3FRQ(word period, byte PS);Sub Timer_T3FRQ(period As Word, PS
30Hardware© 2013 Conrad Electronic2.1.4.3 Connection Diagram The shown connection diagram shows the planned C-Control Pro Module with CAN Bus inter-
381 C-Control Pro IDE© 2013 Conrad Electronicperiod period durationskew phase shiftPS prescaler (table prescaler)5.26.1.35 Timer_T3GetCNTTimer Func
382Libraries© 2013 Conrad Electronic5.26.1.37Timer_T3PWATimer FunctionsSyntaxvoid Timer_T3PWA(word PW0);Sub Timer_T3PWA(PW0 As Word)DescriptionThis fu
383 C-Control Pro IDE© 2013 Conrad ElectronicPS_1024 (5) 69,44 µs 64 µs 5.26.1.39 Timer_T3PWBTimer FunctionsSyntaxvoid Timer_T3PWB(word PW1);Sub Timer
384Libraries© 2013 Conrad ElectronicPS_1 (1) 67,8 ns 62,5 ns PS_8 (2) 542,5 ns500 ns PS_64 (3) 4,34 µs4 µs PS_256 (4) 17,36 µs 16 µs PS_1024 (5) 69,44
385 C-Control Pro IDE© 2013 Conrad ElectronicParameterperiod period durationPW0 pulse width channel APW1 pulse width channel BPW2 pulse widt
386Libraries© 2013 Conrad Electronic5.26.1.45Timer_T3TimeTimer FunctionsSyntaxvoid Timer_T3Time(word Time, byte PS);Sub Timer_T3Time(Time As Word, PS
387 C-Control Pro IDE© 2013 Conrad ElectronicReturn Parametertime interval expressed in 10ms ticks Examplevoid main(void){ word time; Timer_Tick
388Libraries© 2013 Conrad Electronicword cnt;void count_irq(void){ cnt++; Irq_GetCount(INT_TIMER0);}void main(void){ cnt= 0; Irq_SetVect(I
389 C-Control Pro IDE© 2013 Conrad Electronic5.26.2.3Pulse Width ModulationThe C-Control AVR32Bit can output a pulse width modulated signal on up to 4
390Libraries© 2013 Conrad ElectronicTo create the mode parameter, the bit values from the table are ORed (see PWM_Example). For a more detailed
C-Control Pro IDEIII© 2013 Conrad Electronic...
31 C-Control Pro IDE© 2013 Conrad Electronic In the graph the socket strip X1-X4 and then the first two pins of the socket strip can be seen. Pin
391 C-Control Pro IDE© 2013 Conrad ElectronicDuring operation the period (frequency), duty (latitude) and deadtime of the PWM signal can bespecif
392Libraries© 2013 Conrad Electronic5.26.2.8Timer_CPUCyclesTimer FunctionsSyntaxdword Timer_CPUCycles(void);Sub Timer_CPUCycles() As ULongDescriptionM
393 C-Control Pro IDE© 2013 Conrad ElectronicSub Timer_GetCounterVal(timer As Byte) As WordDescriptionReturns the 16-bit counter of a timer.Parameter
394Libraries© 2013 Conrad ElectronicTIM_128 (4) 1,939 µs Table flags:DefinitionMeaningTIMFLG_IRQInterrupts are generatedTIMFLG_PINAsignal is output on
395 C-Control Pro IDE© 2013 Conrad Electronic5.27 Webserver (AVR32Bit)The web server of the C-Control Pro AVR32Bit is started with WEB_StartServer.
396Libraries© 2013 Conrad ElectronicURL (CGI) VariablesWhen there are no URL variables specified for a web request, the whole process runs in the back
397 C-Control Pro IDE© 2013 Conrad ElectronicWeb Server OptimizationThe lwIP TCP / IP stack is optimized to work best with embedded devices that s
398Libraries© 2013 Conrad Electronic5.27.3 WEB_GetFileHashEthernet FunctionsSyntaxword WEB_GetFileHash(byte request);Sub WEB_GetFileHash(request As By
399 C-Control Pro IDE© 2013 Conrad Electronicvoid WEB_SetDynVar(word indx, ptr var_addr[], byte type, byte flags,byte len);Sub WEB_SetDynVar(i
400Libraries© 2013 Conrad Electronic5.27.6 WEB_StartServerEthernet FunctionsSyntaxvoid WEB_StartServer(word port, byte ramaddr[], word dynvar_cn
32Hardware© 2013 Conrad ElectronicClock GenerationClock generation takes place by a 16MHz Quartz Oscillator. All time dependent actions within thecont
401 C-Control Pro IDE© 2013 Conrad ElectronicDescriptionStops the webserver.Parameter None
403 C-Control Pro IDE© 2013 Conrad ElectronicFAQ66.1 General1. The spelling check does not function.Is the spelling check switched on in Options->E
404FAQ© 2013 Conrad ElectronicThere are many developing systems for the Atmel Mega CPU. Some of these Compilers are com-mercial, others a free. A good
405 C-Control Pro IDE© 2013 Conrad Electronic6. How much RAM do I have for my programs?There are 930 bytes left for own programs on the Mega32, on the
406FAQ© 2013 Conrad Electronic3. I need more ports for my hardware application. Many ports are used by other functions.Take a look at the Pin Assignme
C-Control Pro IDE407© 2013 Conrad ElectronicIndex- - --- 180, 201- # -#define 167#endif 167#ifdef 167#include 167#pragma 169-
Index408© 2013 Conrad ElectronicClock_SetTime 247COM Interface 144COM Port 161Comments 171, 193CompactC 170Comparison Operators
C-Control Pro IDE409© 2013 Conrad Electronicexp 292Expressions 171, 193Ext 277Ext_IntDisable 279Ext_IntEnable 278external RAM
Index410© 2013 Conrad ElectronicKeyboard Layout 156Keyboard Shortcuts 141- L -LCD Matrix 127LCD_ClearLCD 284LCD_CursorOff 285LCD_C
33 C-Control Pro IDE© 2013 Conrad ElectronicThere are three timers available for PLM. These are Timer_0 with 8 bits and Timer_1 as well asTimer_
C-Control Pro IDE411© 2013 Conrad ElectronicPort_ToggleBit 305Port_Write 306Port_WriteBit 306Port-Ext-Board 108pow 295Precedence
Index412© 2013 Conrad ElectronicSPI switch off 16SPI_Disable 340, 343SPI_Enable 341, 343SPI_Read 341, 344SPI_ReadBuf 342, 344SPI_S
C-Control Pro IDE413© 2013 Conrad ElectronicTimer_T3GetPM 381Timer_T3PM 382Timer_T3PWA 382Timer_T3PWB 383Timer_T3PWM 383Timer_T3PW
34Hardware© 2013 Conrad ElectronicPortsMax. admissible current from digital ports± 20 mAAdmissible current total on digital ports200mAAdmissible input
35 C-Control Pro IDE© 2013 Conrad Electronic• 10-bit Prescaler• External Event Counter• Output Compare or 8-bit PWM Output8-bit Asynchronous Timer/Cou
36Hardware© 2013 Conrad ElectronicPin Assignment for Application Board Mega128 CANModuleM128PortPort#PortBitName1Name2InternalRemarks1PENprog. EnableX
37 C-Control Pro IDE© 2013 Conrad ElectronicX3_1347PA404AD4A/D SRAMX3_1248PA303AD3A/D SRAMX3_1149PA202AD2A/D SRAMX3_1050PA101AD1A/D SRAMX3_951PA000AD0
38Hardware© 2013 Conrad Electronic2.1.5.3Connection Diagram The connection diagram shows the new C-Control Pro Mega128 CAN module with CAN bus.
39 C-Control Pro IDE© 2013 Conrad Electronic
40Hardware© 2013 Conrad Electronic2.1.6 Mega32 Application BoardUSBThe "C-Control Pro Application Board MEGA 32" (Conrad Item no. 198245) pr
IVInhalt© 2013 Conrad Electronic...
41 C-Control Pro IDE© 2013 Conrad Electronicconsists of a monochrome matrix of 5x7 pixels. A flashing cursor below any one of the characterswill indic
42Hardware© 2013 Conrad Electronicity of 125mA it is not recommended for use in devices consistently battery operated. Please see thenote on short tim
43 C-Control Pro IDE© 2013 Conrad ElectronicTesting InterfacesThe 4 pole pin strip X16 is to be used for testing purposes only and will not necessar
44Hardware© 2013 Conrad Electronicnected to the module while the left side connects to the components of the application board. If anyjumper is pulled
45 C-Control Pro IDE© 2013 Conrad ElectronicJP6When using the displays the LED back lighting can be switched off by use of JP6.PAD3PAD3 (to the right
46Hardware© 2013 Conrad Electronic2.1.6.2Connection DiagramTitleNumber RevisionSizeA3Date: 01.12.2004 Sheet of File: C:\Altium2004\..\Board.sch Dra
47 C-Control Pro IDE© 2013 Conrad ElectronicTitleNumber RevisionSizeA4Date: 01.12.2004 Sheet of File: C:\Altium2004\..\DispKey.sch Drawn By:PT110K/
48Hardware© 2013 Conrad ElectronicTitleNumber RevisionSizeA4Date: 01.12.2004 Sheet of File: C:\Altium2004\..\SpiUsb.Sch Drawn By:21345X12D-USB-B-61
49 C-Control Pro IDE© 2013 Conrad Electronic2.1.6.3Component Parts Plan
50Hardware© 2013 Conrad Electronic2.1.7 Mega128 Application BoardUSBThe "C-Control Pro Application Board MEGA 128" (Conrad Item no. 198258)
C-Control Pro IDEV© 2013 Conrad Electronic...
51 C-Control Pro IDE© 2013 Conrad ElectronicAn LCD module can be plugged onto the application board. It displays 2 lines at 8 characters each.In gener
52Hardware© 2013 Conrad ElectronicI2C InterfaceThrough this interface serial data can be transmitted at high speed. To do this only two signal linesar
53 C-Control Pro IDE© 2013 Conrad Electronic Never connect the serial transmission outputs of two devices directly together! Transmission out-puts ca
54Hardware© 2013 Conrad ElectronicTo deactivate the SRAM the jumper JP7 has to be moved to the left side (orientation: serial interfaceshows to the le
55 C-Control Pro IDE© 2013 Conrad ElectronicJP1 and JP2These jumpers are assigned to push buttons SW1 and SW2. There is the possibility to operate the
56Hardware© 2013 Conrad Electronic2.1.7.3Connection DiagramC10100nFC11100nF- +C12100uF- +C1310uFC14100nFC15100nFC32100nFC6100nFC710nFC9100nFD11N4007D2
57 C-Control Pro IDE© 2013 Conrad ElectronicC16100nFC17100nFC18100nFC19100nFC20100nFC21100nFC22100nFC2333nFC2433pFC2533pFC2633pFC2733pFC33100nF10mmPro
58Hardware© 2013 Conrad Electronic2.1.7.4Component Parts Plan
59 C-Control Pro IDE© 2013 Conrad Electronic2.1.8 Mega32 ProjectboardThe C-Control Projectboard PRO32 (Conrad Item no. 197287) provides a economic alt
60Hardware© 2013 Conrad Electronictotype area are no longer energized when using USB operation. This supply is used only for testapplications, when th
VIInhalt© 2013 Conrad Electronic...
61 C-Control Pro IDE© 2013 Conrad Electronic2.1.9 Mega128 ProjectboardThe "C-Control PRO 128 Projectboard" (Conrad Item no. 197313) provides
62Hardware© 2013 Conrad Electronic Attention! A maximum current of 100mA through USB should not be exceeded!The switch S3 and the power supply pin
63 C-Control Pro IDE© 2013 Conrad ElectronicMax continuous current from the stabilized 5V voltage: 100 mA (without cooling)Prototype area: 2.54 mmRang
64Hardware© 2013 Conrad Electronic2.2.1.2 USBDriver InstallationNow connect the Unit with the supplied mini-USB cable to the PC (the cable is enclosed
65 C-Control Pro IDE© 2013 Conrad ElectronicNow you can already transfer a program to the Unit. The demo programs can be found if you click inthe IDE
66Hardware© 2013 Conrad Electronic The library function ForceBootloader(), as well as a change in the "C-Control Configuration"AV
67 C-Control Pro IDE© 2013 Conrad Electronic2.2.3 ModuleThe C-Control Pro AVR32Bit UNIT (Conrad Order No.: 192573) is currently the fastest microcontr
68Hardware© 2013 Conrad ElectronicScheme of the AVR32Bit UnitPicture UNIT (view from above)Picture UNIT (view from below)
69 C-Control Pro IDE© 2013 Conrad ElectronicJumper:J1: enables Autostart of user applicationJ2: enables CAN 120Ohm terminatorPin layout of the ModuleP
70Hardware© 2013 Conrad Electronic3.3V and the GND pins are connected to each other! The "POWER" LED indicates that the Unit isreceiving pow
C-Control Pro IDEVII© 2013 Conrad Electronic...
71 C-Control Pro IDE© 2013 Conrad ElectronicIf the Autostart Jumper (J1) is inserted, the user program immediately restarts after a reset. On deliver
72Hardware© 2013 Conrad ElectronicSince the outputs of the AVR32Bit Unit can not be overly stressed, a small driver stage should al-ways (see picture)
73 C-Control Pro IDE© 2013 Conrad ElectronicThe following reference voltage sources are available:0,6 * VDDANA internal (0,6 * 3.3V = 1,98V)internal r
74Hardware© 2013 Conrad ElectronicTechnical Datapower supply VCC3 to 3.6V Nominal 3.3V / >200mA (stabilized)maximum voltage at the pins-0.3V to 3.6
75 C-Control Pro IDE© 2013 Conrad Electronicoutput driver strength is programmable with the Port_Attribute() function.2.2.3.1 Pin AssignmentPort A thr
76Hardware© 2013 Conrad ElectronicP28X1.36PB204352TIMER0-BP29X1.37PB214453COUNTA-1P30X1.38PB224554TIMER2-AP31X1.39PB234655TIMER2-BP32X2.42PC015065TIME
77 C-Control Pro IDE© 2013 Conrad ElectronicUNIT PinoutHardwired PinsC-ControlModule PinTQFP 100AVR32 Port NameGPIOFunctionI/OX1.05, X1.065VDDIO13,3VX
78Hardware© 2013 Conrad Electronic39VDDIN_333,3V40VDDCORE3,3V41GNDCOREGND53VDDIO23,3V54GNDIO2GND82VDDIO33,3V83GNDIOGND96PB0032RTCXin3297PB0133RTCXout3
79 C-Control Pro IDE© 2013 Conrad ElectronicX1.46CAN DriverCAN0_HIX2.07PHYLAN_RD-X2.08PHYLAN_RD+X2.09PHYLAN_TD-X2.10PHYLAN_TD+X2.11PHYLAN_LED_LNKX2.12
80Hardware© 2013 Conrad Electronic2.2.3.2Connection Diagram
VIIIInhalt© 2013 Conrad Electronic...
81 C-Control Pro IDE© 2013 Conrad Electronic
82Hardware© 2013 Conrad Electronic2.2.4 ApplicationboardThe C-Control PRO AVR32Bit Applicationboard (Conrad Order No.: 192587) is the standard develop
83 C-Control Pro IDE© 2013 Conrad ElectronicInstallation / CommissioningThe C-Control PRO AVR32Bit UNIT is attached that the mini-USB socket of the Un
84Hardware© 2013 Conrad ElectronicConnection Diagram cutout of I2C-LCDLC-Display contrast controlThe best visibility of the LCD character arises in fr
85 C-Control Pro IDE© 2013 Conrad ElectronicExamplel connect LED3 and LED4 to P32 and P33LED'sThe pins of the connector strips Y10 (10 pin) are
86Hardware© 2013 Conrad ElectronicExample connect reference voltage to ADCREF0CAN BusAt clamp J6 the CAN bus (CAN0) is led out of the UNIT and can be
87 C-Control Pro IDE© 2013 Conrad ElectronicExample connect trimmer to ADC0 and ADC1 with external reference voltage 2.048VKeypad For user inputs a 5-
88Hardware© 2013 Conrad ElectronicExample connect Relay to P54FET driverThe pins of the socket strip Y15 are connected to the open-drain FET driver.
89 C-Control Pro IDE© 2013 Conrad ElectronicExample FET driver with load controlled by P53USB to UART ConverterThe pins on the socket connector Y5 (4
90Hardware© 2013 Conrad ElectronicExample connect USB-UART converter to UART0RS232 to UART ConverterThe pins on the socket connector Y6 (4 pin) are co
Comentarios a estos manuales