quick reference - grifo

29
QUICK REFERENCE BASIC 52 http://www.grifo.it http://www.grifo.com Tel. +39 051 892.052 (a.r.) FAX +39 051 893.661 grifo ® ITALIAN TECHNOLOGY Via dell' Artigiano, 8/6 40016 San Giorgio di Piano (Bologna) ITALY Email: [email protected] BASIC 52 8052 MICROCONTROLLER BASIC Edition 3.00 Rel. 11 January 1999 , GPC ® , grifo ® , are trade marks of grifo ®

Upload: others

Post on 06-Nov-2021

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: QUICK REFERENCE - grifo

QUICK REFERENCE

BASIC 52

http://www.grifo.it http://www.grifo.comTel. +39 051 892.052 (a.r.) FAX +39 051 893.661

grifo ®

ITALIAN TECHNOLOGY

Via dell' Artigiano, 8/640016 San Giorgio di Piano

(Bologna) ITALYEmail: [email protected]

BASIC 528052 MICROCONTROLLER BASIC

Edition 3.00 Rel. 11 January 1999

, GPC®, grifo ®, are trade marks of grifo ®

Page 2: QUICK REFERENCE - grifo

QUICK REFERENCE

BASIC 52

http://www.grifo.it http://www.grifo.comTel. +39 051 892.052 (a.r.) FAX +39 051 893.661

grifo ®

ITALIAN TECHNOLOGY

Via dell' Artigiano, 8/640016 San Giorgio di Piano

(Bologna) ITALYEmail: [email protected]

BASIC 528052 MICROCONTROLLER BASIC

Edition 3.00 Rel. 11 January 1999

, GPC®, grifo ®, are trade marks of grifo ®

MCS BASIC 52 is a powerfull software tool , capable of managing aBASIC high level programmation of all Intel 51 family based cards. Itis a "romated" software that generates "romable" software in an easy touse enviroment; it also reduces the necessity of external hardware (incircuit emulator, EPROM programmer, etc;) and at the same time itspeeds up debugging phase of the User application program.MCS BASIC 52 is referred to generic software tools, but each cards hasa specific version of software associated to their hardware features; sofor each card the name MCS BASIC 52 become BASIC followed bythe card final name.

Page 3: QUICK REFERENCE - grifo

QUICK REFERENCE

BASIC 52

http://www.grifo.it http://www.grifo.comTel. +39 051 892.052 (a.r.) FAX +39 051 893.661

grifo ®

ITALIAN TECHNOLOGY

Via dell' Artigiano, 8/640016 San Giorgio di Piano

(Bologna) ITALYEmail: [email protected]

BASIC 528052 MICROCONTROLLER BASIC

Edition 3.00 Rel. 11 January 1999

, GPC®, grifo ®, are trade marks of grifo ®

DOCUMENTATION COPYRIGHT BY grifo ® , ALL RIGHTS RESERVED.

No part of this document may be reproduced, transmitted, transcribed, stored in aretrieval system, or translated into any language or computer language, in any form orby any means, either electronic, mechanical, magnetic, optical, chemical, manual, orotherwise, without the prior written consent of Grifo ®.

IMPORTANT

Although all the information contained herein have been carefully verified, Grifo ®

assumes no responsibility for errors that might appear in this document, or for damageto things or persons resulting from technical errors, omission and improper use of thismanual and of the related software and hardware.Grifo ® reservs the right to change the contents and form of this document, as well as thefeatures and specification of its products at any time, without prior notice, to obtainalways the best product.For specific informations on the components mounted on the card, please refer to theData Book of the builder or second sources.

SYMBOLS DESCRIPTION

In the manual could appear the following symbols:

Attention: Generic danger

Attention: High voltage

Trade marks

, GPC®, Grifo ® : are trade marks of Grifo ®.Other Product and Company names listed, are trade marks of their respective companies.

Page 4: QUICK REFERENCE - grifo

ITALIAN TECHNOLOGY grifo ®

Page 1 Basic - 52

GENERAL INDEXQUICK REFERENCE TO MCS BASIC 52 .............................................................................. 1 CONVENTIONS ........................................................................................................................ 1 OPERATOR LIST ...................................................................................................................... 1 INSTRUCTIONS LIST.............................................................................................................. 2

BASIC 52 MODIFICATIONS FOR GRIFO ®'S CARDS ....................................................... 12 REMOVED COMMANDS, INSTRUCTIONS, OPERATORS ........................................... 12 ADDED COMMANDS............................................................................................................. 12 ADDED OPERATORS............................................................................................................. 12 ADDED INSTRUCTIONS....................................................................................................... 12 SECOND SERIAL MANAGEMENT (SOFTWARE SERIAL LINE) .............................. 13 A/D CONVERTER MANAGEMENT .................................................................................. 13 REAL TIME CLOCK INTERRUPT MANAGEMENT .................................................... 14 BLOCK READ/WRITE ON SERIAL EEPROM AND RAM RTC .................................. 14 BYTE READ/WRITE ON SERIAL EEPROM AND RAM RTC...................................... 14 OPERATOR KEYBOARD MANAGEMENT..................................................................... 15 OPERATOR DISPLAY SELECTION AND INITIALIZATION ...................................... 15 82C55 INITIALIZATION FOR CONSOLE REDIRECTION MANAGEMENT........... 15 SFR (SPECIAL FUNCTION REGISTER) READ/WRITE............................................... 16 REAL TIME CLOCK MANAGEMENT ............................................................................. 17 PWM LINES MANAGEMENT ............................................................................................ 17

Page 5: QUICK REFERENCE - grifo

grifo ® ITALIAN TECHNOLOGY

Page 2 Basic - 52

FIGURE INDEXFIGURE 1: ADDED INSTRUCTION TABLE ............................................................................................ 13FIGURE A-1: KDX X24 ELECTRIC DIAGRAM .................................................................................. A-1FIGURE A-2: QTP 24P ELECTRIC DIAGRAM PART 1 ...................................................................... A-2FIGURE A-3: QTP 24P ELECTRIC DIAGRAM PART 2 ...................................................................... A-3FIGURE A-4: QTP 16P ELECTRIC DIAGRAM ................................................................................. A-4FIGURE A-5: PPI 82C55 ELECTRIC DIAGRAM ............................................................................... A-5

Page 6: QUICK REFERENCE - grifo

ITALIAN TECHNOLOGY grifo ®

Page 1 Basic - 52

QUICK REFERENCE TO MCS BASIC 52QUICK REFERENCE TO MCS BASIC 52

This quick reference to the BASIC 52 programming language lists the keywords alphabetically,along with brief descriptions of function and use.

CONVENTIONS

The reference uses the following typographic conventions:

KEYWORDS (boldface uppercase)BASIC 52 keywords

placeholders (italics)Variables, expressions, constants, or other information that you must supply

[optional items] (enclosed in square brackets)Items that are not required

repeating elements... (followed by ellipsis (three dots))You may add more items with the same form as the preceding item.

OPERATOR LISTC = command modeR = run mode

variable = expression C,RAssigns a value to a variable

expression = expression C,REquivalence test (relational operator)

expression + expression C,RAdd

expression - expression C,RSubtract

expression * expression C,RMultiplyexpression / expression C,RDivide

expression ** expression C,RRaises first expression to value of second expression (exponent)

expression <> expression C,RInequality test (relational operator)

Page 7: QUICK REFERENCE - grifo

grifo ® ITALIAN TECHNOLOGY

Page 2 Basic - 52

expression < expression C,RLess than test (relational operator)

expression > expression C,RGreater than test (relational operator)

expression <= expression C,RLess than or equal test (relational operator)

expression >= expression C,RGreater than or equal test (relational operator)

INSTRUCTIONS LIST

?Same as PRINT

ABS (expression) C,RReturns the absolute value of expression

expression .AND. expression C,RLogical AND

ASC(character) C,RReturns the value of ASCII character

ATN (expression) C,RReturns the arctangent of expression

BAUD expression C,RSets the baud rate for LPT (pin 8). For proper operation, XTAL must match thesystem’s crystal frequency.

CALL integer C,RCalls an assembly-language routine at the specified address in program memory.

CBY(expression) C,RRetrieves the value at expression in program, or code, memory.

CHR(expression) C,RConverts expression to its ASCII character.

CLEAR C,RSets all variables to 0, resets all stacks and interrupts evoked by BASIC.

CLEARI C,RClears all interrupts evoked by BASIC. Disables ONTIME, ONEX1.

Page 8: QUICK REFERENCE - grifo

ITALIAN TECHNOLOGY grifo ®

Page 3 Basic - 52

CLEARS C,RResets BASIC 52’s stacks. Sets control stack = 0FEh, argument stack = 1FEh,internal stack = value in 3Eh in internal RAM.

CLOCK0 C,RDisables the real-time clock.

CLOCK1 C,REnables the real-time clock.

CONT CContinues executing program after STOP or CONTROL+C.

COS(expression) C,RReturns the cosine of expression

CRPRINT option. Causes a carriage return, but no line feed, on the host display.

DATA expression [,...,expression] RSpecifies expressions to be retrieved by a READ statement.

DBY(expression) C,RRetrieves or assigns a value at expression in internal data memory.

DIM array name [(size)] [,...array name(size)] C,RReserves storage for an array. Default size is 11 (0-10). Size limits are 0-254.

DO: [program statements]: UNTIL relational expression RExecutes all statements between DO and UNTIL until relational expression istrue.

DO: [program statements]: WHILE relational expression RExecutes all statements between DO and WHILE until relational expression isfalse.

END RTerminates program execution.

EXP (expression) C,RRaises e (2.7182818) to the power of expression

FOR counter variable = start-count expression C,RTO end-count expression [STEP count-increment expression]: [program statements]:NEXT [counter variable]

Executes all statements between FOR and NEXT the number of times specified bythe counter and step expressions.

Page 9: QUICK REFERENCE - grifo

grifo ® ITALIAN TECHNOLOGY

Page 4 Basic - 52

FPROG, FPROG1-FPROG6 CLike PROG, PROG1-PROG6, but using Intelligent programming algorithm.

FREE C,RReturns the number of bytes of unused external data RAM.

GET RContains the ASCII code of a character received from the host computer’skeyboard. After a program reads the value of GET (For example, G=GET), GETreturns to 0 until a new character arrives.

GOSUB line number RCauses BASIC 52 to transfer program control to a subroutine beginning at linenumber. A RETURN statement returns control to the line number following theGOSUB statement.

GOTO line number C,RCauses BASIC 52 to jump to line number in the current program.

IDLE RForces BASIC 52 to wait for ONTIME or ONEX1 interrupt.

IE C,RRetrieves or assigns a value to the 8052’s special function register IE.

IF relational expression RTHEN program statements[ELSE] [program statements]

If relational expression is true, executes program statements following THEN. Ifrelational expression is false, executes program statements following ELSE, ifused.

INPUT [“ Prompt message” ][,] variable [,variable] [,...variable] RDisplays a question mark and optional prompt message on the host computer andwaits for keyboard input. Stores input in variable(s). A comma before the firstvariable suppresses the question mark.

INT (expression) C,RReturns integer portion of expression.

IP C,RRetrieves or assigns a value to the 8052’s special function register IP.

LD@ expression C,RRetrieves a 6-byte floating-point number and places it on the argument stack.Expression points to the most significant byte of the number.

LEN C,RReturns the number of bytes in the current program.

Page 10: QUICK REFERENCE - grifo

ITALIAN TECHNOLOGY grifo ®

Page 5 Basic - 52

[LET ] variable = expression C,RAssigns a variable to the value of expression. Use of LET is optional.

LIST [line number][- line number] C,RDisplays the current program on the host computer.

LIST# [line number][- line number] C,RWrites the current program to LPT (pin 8).

LIST@ [line number][- line number] C,RWrites the current program to a user-written assembly-language output driver at40C3h. Setting bit 7 of internal data memory location 27H enables the driver.

LOG (expression) C,RReturns natural logarithm of expression.

MTOP [=highest address in RAM program space] C,RAssigns or reads the highest address BASIC 52 will use to store variables,strings, and RAM programs. Usually 7FFFh or lower, since EPROM spacebegins at 8000h.

NEW CErases current program in RAM; clears all variables.

NOT (expression) C,RReturns 1’s complement (inverse) of expression.

NULL [integer] CSets the number (0-255) of NULL characters (ASCII 00) that BASIC 52 sendsautomatically after a carriage return. Only very slow printers or terminals needthese extra nulls.

ON expression GOSUB line number [,line number] [,...,line number] RTransfers program control to a subroutine beginning at one of the line numbers inthe list. The value of expression matches the position of the line number selected,with the first line number at position 0.

ON expression GOTO line number [,line number] [,...,line number] RTransfers program control to one of the line numbers in a list of numbers. Thevalue of expression matches the position of the line number selected, with thefirst line number at position 0.

ONERR line number RPasses control to line number following an arithmetic error. Arithmetic errorsinclude ARITH. OVERFLOW, ARITH. UNDERFLOW, DIVIDE BY ZERO,and BAD ARGUMENT.

Page 11: QUICK REFERENCE - grifo

grifo ® ITALIAN TECHNOLOGY

Page 6 Basic - 52

ONEX1 line number ROn interrupt 1 (pin 13), BASIC 52 finishes executing the current statement, andthen passes control to an interrupt routine beginning at line number. The interruptroutine must end with RETI.

ONTIME number of seconds, line number RWhen TIME = number of seconds, BASIC 52 passes control to an interruptroutine beginning at line number. The interrupt routine must end with RETI.CLOCK1 starts the timer.

expression .OR. expression C,RLogical OR

P.Same as PRINT

PCON C,RRetrieves or assigns a value to the 8052’s special function register PCON.

PGM C,RPrograms an EPROM, EEPROM, or NV RAM with data from memory. Thefollowing data must be stored in internal data memory in the locations listed:1Bh,19h High byte, low byte of first address of data to program1Ah,18h High byte, low byte of first address to be programmed - 11Fh,1Eh High byte, low byte indicating number of bytes to program40h,41h High byte, low byte indicating width of programming pulse.

High byte = ((65536 - pulse width in seconds * XTAL/12) / 256.Low byte = ((65536 - pulse width in seconds * XTAL/12) .AND. 0FFh.

26h For Intelligent programming, set bit 3.For 50-millisecond programming, clear bit 3.

PH0. C,RSame as PRINT, but displays values in hexadecimal format. Uses two digits todisplay values less than 0FFh.

PH0.# C,RSame as PRINT#, but displays values in PH0. hexadecimal format

PH0.@ C,RSame as PRINT@, but outputs values in PH0. hexadecimal format.

PH1. C,RSame as PRINT, but displays values in hexadecimal format. Always displaysfour digits.

PH1.# C,RSame as PRINT#, but displays values in PH1. hexadecimal format.

Page 12: QUICK REFERENCE - grifo

ITALIAN TECHNOLOGY grifo ®

Page 7 Basic - 52

PH1.@ C,RSame as PRINT@, but outputs values in PH1. hexadecimal format.

PI C,RConstant equal to 3.1415926.

POP variable [,...variable] C,RAssigns the value of the top of the argument stack to variable.

PORT1 C,RRetrieves or assigns a value to PORT1 (pins 1-8).

PRINT [expression] [,...expression] [,] C,RDisplays the value of expression(s) on the host computer. A comma at the endof the statement suppresses the CARRIAGE RETURN/LINEFEED. Values areseparated by two spaces. Additional PRINT options are CR, SPC, TAB, USING.

PRINT# C,RSame as PRINT, but outputs to LPT (pin 8). BAUD and XTAL values affect thePRINT# rate.

PRINT@ C,RSame as PRINT, but outputs to a user-defined output driver. Requires anassembly language output routine at 403Ch in external program memory.Setting bit 7 of internal data memory location 24h enables the output routine.

PROG CStores the current RAM program in the EPROM space.

PROG1 CSaves the serial-port baud rate. On power-up or reset, BASIC 52 boots withouthaving to receive a space character. The terminal’s baud rate must match thestored value.

PROG2 CLike PROG1, but on power-up or reset, BASIC 52 also begins executing the firstprogram in the EPROM space.

PROG3 CLike PROG1, but also saves MTOP. On power-up or reset, BASIC 52 clearsmemory only to MTOP.

PROG4 CLike PROG2, but also saves MTOP. On power-up or reset, BASIC 52 clearsmemory only to MTOP.

Page 13: QUICK REFERENCE - grifo

grifo ® ITALIAN TECHNOLOGY

Page 8 Basic - 52

PROG5 CLike PROG3, but also reads 5Fh in external data memory on power-up or reset.If 5Fh contains 0A5h, BASIC 52 doesn’t clear external data memory. If datamemory location 5Eh contains 34h, BASIC 52 will automatically begin execut-inga program in external data memory.

PROG6 CLike PROG5, but if external data memory location contains 5Fh, BASIC 52 callsa user-written assembly-language reset routine beginning at program memory4039h.

PUSH expression [,...expression] C,RPlaces the values of expression(s) sequentially on BASIC 52’s argument stack.

PWM expression1, expression2, expression3 C,ROutputs a pulse-width modulated (PWM) sequence of pulses on pin 3.Expression1 is the width of each high pulse, expressed in clock cycles. Expression2is the width of each low pulse, expressed in clock cycles. Expression3 is the numberof PWM cycles output. One clock cycle = 12/XTAL. One PWM cycle = one highpulse plus one low pulse. Expression1 and Expression2 must each be at least 25.Maximum for each Expression is 65535.

RAM CSelects the current program in the RAM space.

RCAP2 C,RRetrieves or assigns a value to the 8052’s special function registers RCAP2H andRCAP2L.

READ variable [,...,variable] RRetrieves the expressions in a DATA statement and assigns each expression to avariable.

REM C,RIntroduces a comment, or remark. BASIC 52 ignores all text after REM in aprogram line.

RESTORE RResets READ pointer to the first expression in the DATA statement.

RETI RReturns program control to the line number following the most recently executedONEX1 or ONTIME statement.

RETURN RReturns program control to the line number following the most recently executedGOSUB statement.

Page 14: QUICK REFERENCE - grifo

ITALIAN TECHNOLOGY grifo ®

Page 9 Basic - 52

RND C,RReturns a pseudo-random number between 0 and 1 inclusive.

ROM [program number] CSelects a program in the EPROM space (beginning at 8000h). Default programnumber is 1.

RROM [program number] C,RChanges to ROM mode and runs the specified program. Default program numberis 1.

RUN RExecutes the current program. Clears all variables.

SGN (expression) C,RReturns +1 if expression >=0, zero if expression = 0, and -1 if expression <0.

SIN(expression) C,RReturns the sine of expression

SPC (expression)PRINT option. Causes the display to place expression additional spaces (besidesthe minimum two) between values in a PRINT statement.

SQR(expression) C,RReturns square root of expression.

ST@ expression C,RCopies a 6-byte floating-point number from the argument stack to external datamemory. Expression points to the most significant byte of the number.

STOPHalts program execution.

STRING expressions, expression2 C,RAllocates memory for strings (variables each consisting of a series of textcharacters).Expression1 = (Expression2 * number of strings) + 1.Expression2 = maximum number of bytes (characters) per string + 1. ExecutingSTRING clears all variables. Maximum number of strings is 255.

T2CON C,RRetrieves or assigns a value to the 8052’s special function register T2CON.

TAB (expression)PRINT option. Specifies the position (number of spaces) to begin displaying thenext value in the PRINT statement.

Page 15: QUICK REFERENCE - grifo

grifo ® ITALIAN TECHNOLOGY

Page 10 Basic - 52

TAN (expression) C,RReturns the tangent of expression.

TCON C,RRetrieves or assigns a value to the 8052’s special function register TCON.

TIME C,RRetrieves or assigns a value, in seconds, to BASIC 52’s real-time clock.

TIMER0 C,RRetrieves or assigns a value to the 8052’s special function registers TH0 and TL0.

TIMER1 C,RRetrieves or assigns a value to the 8052’s special function registers TH1 and TL1.

TIMER2 C,RRetrieves or assigns a value to the 8052’s special function registers TH2 and TL2.

TMOD C,RRetrieves or assigns a value to the 8052’s special function register TMOD.

U.PRINT option. Same as USING.

UI0 C,RRestores BASIC 52’s console input driver after using UI1.

UI1 C,RAllows a user-provided assembly-language console (host computer) input routineto replace BASIC 52’s console input driver. External program memory location4033h must contain a jump to the user’s routine.

UO0 C,RRestores BASIC 52’s console output driver after using UI1.

UO1 C,RAllows a user-provided assembly-language console (host computer) outputroutine to replace BASIC 52’s console output driver. External program memory loca-tion 4030h must contain a jump to the user’s routine.

USING (FN)PRINT option. Causes BASIC 52 to output numbers in exponential formatwith N significant digits. BASIC 52 always outputs at least 3 significant digits.Maximum expression is 8.

USING(0)PRINT option. Causes BASIC 52 to output numbers from ±.99999999 to ±0.1 asdecimal fractions. Numbers outside this range display in USING (FN) format.USING(0) is the default format.

Page 16: QUICK REFERENCE - grifo

ITALIAN TECHNOLOGY grifo ®

Page 11 Basic - 52

USING (#[...#][.]#[...#])PRINT option. Causes BASIC 52 to output numbers using decimal fractions,with # representing the number of significant digits before and after the decimalpoint. Up to eight # characters are allowed.

XBY (expression) C,RRetrieves or assigns a value in external data memory.

XFER CCopies the current program from the EPROM space (beginning at 8010h forprogram 1) to RAM (beginning at 200h), and selects RAM mode.

expression .XOR. expression C,RLogical exclusive OR

XTAL C,RAssigns a value equal to the system’s crystal frequency, for use by BASIC 52 intiming calculations.

Page 17: QUICK REFERENCE - grifo

grifo ® ITALIAN TECHNOLOGY

Page 12 Basic - 52

BASIC 52 MODIFICATIONS FOR GRIFOBASIC 52 MODIFICATIONS FOR GRIFO ®®'' SS CARDS CARDS

Here follows a brief description of MCS BASIC 52 variation=BASIC xxx, performed by grifo ® tosatisfy all user's requests.

REMOVED COMMANDS, INSTRUCTIONS, OPERATORS

Removed commands Removed instruction Removed operatorsLIST# BAUD NoneFPROG PRINT#FPROG1 PH0.#FPROG2 PH1.#FPROG3 PWMFPROG4FPROG5FPROG6

ADDED COMMANDS

ERASE -> Deletes EEPROM content removing all the application program saved in withcommand PROG,PROG1,...PROG6.

ADDED OPERATORS

None.

ADDED INSTRUCTIONS

Here a summary of the differences between original MCS BASIC 52 and BASIC for GRIFO's cards.This additions are really interesting to manage on board hardware resources with high levelintrunctions. With these instructions the development of the application program is really faster andeasier, even for first time users.

Page 18: QUICK REFERENCE - grifo

ITALIAN TECHNOLOGY grifo ®

Page 13 Basic - 52

FIGURE 1: ADDED INSTRUCTION TABLE

SECOND SERIAL MANAGEMENT (SOFTWARE SERIAL LINE)

COM2 (expression)This procedure manages all the operation on the software serial line. for the trasmission on this linethe user must use the PRINT@... instruction, while for the reception, there is a buffer allocated inEXTERNAL RAM. If the software serial line management is active, the user can't use the TIMER0 instruction because this timer is used as baud rate generator.(expression) --> 0 = It disables the software serial line

1 = It disables the software serial line at 1200 BAUD2 = It disables the software serial line at 2400 BAUD3 = It disables the software serial line at 4800 BAUD4 = It reads the characters number already saved in the reception buffer5 = It resets the reception buffer

A/D CONVERTER MANAGEMENT

A_D (expression)It performs an A/D conversion of an analog input.The conversion is made on the request channel andthe result is returned to the main program.(expression) --> Channel number (0 to 7)

BASIC 52 FOR

Commandsand

instructions

GPC®

F2GPC®

51GPC®

552GPC®

553GPC®

554GPC®

323GPC®

324GPC®

R63GPC®

T63

ERASE • • • • • • • • •

A_D • • • •

ALARM • • •BL_EEBL_EE2 • • • • •

BY_EE • • • • •COM2 • • • • •

DISPLAY • • • • •

GES_RTC • • •

KEYB • • • • •

P82C55 • • •

RW_SFR • • • • •

SET_PWM • • •

Page 19: QUICK REFERENCE - grifo

grifo ® ITALIAN TECHNOLOGY

Page 14 Basic - 52

REAL TIME CLOCK INTERRUPT MANAGEMENT

ALARM (expression1),(expression2),(expression3),(expression4),(expression5),(expression6),(expression7),(expression8)

It enables the interrupt of RTC so it can generate time based and to manage the allarm.(expr1) --> 0 = It enables NO CLOCK ALARM (ALARM MODE)

1 = It enables DAILY ALARM (ALARM MODE)2 = It enables WEEKDAY ALARM (ALARM MODE)3 = It enables DATED ALARM (ALARM MODE)4 = It enables TIMER (TIMER MODE)5 = Reset flag of ALARM

TIMER MODE(expr2) --> 0 to 99 = Count byte(expr3) --> 0 = No timer

1 = It counts "CENTS OF SECOND"2 = It counts "SECONDS"3 = It counts "MINUTES"4 = It counts "HOURS"5 = It counts "DAYS"

ALARM MODE(expr2) --> Byte with HOURS value (0 to 23).(expr3) --> Byte with MINUTES value (0 to 59)(expr4) --> Byte with SECONDS value (0 to 59)(expr5) --> Byte with DAY OF WEEK value (0 to 59)(expr6) --> Byte with DAY OF MONTH value(1 to 31)(expr7) --> Byte with MONTH value (1 to 12)(expr8) --> Byte with YEAR value (0 to 3)

BLOCK READ/WRITE ON SERIAL EEPROM AND RAM RTC

BL_EE (expression1),(expression2),(expression3)It performs a data block read or write operation at a specified address, on serial EEPROM.TheW/R data buffer is located in EXTERNAL RAM address.(expression1) --> 0 = Reading of a data block

1 = Writing of a data block(expression2) --> Initial location address (0 to last device address)(expression3) --> Number of bytes to write or read (1 to 255)

BYTE READ/WRITE ON SERIAL EEPROM AND RAM RTC

BY_EE (expression1),(expression2),(expression3)It performs a byte read or write operation at a specified address, on serial EEPROM.The user mustremember that in read procedure the (expression3) parameter must be given even if it has no meaning.(expression1) --> 0 = Reading of byte

1 = Writing a byte(expression2) --> Location address (0 to last device address)(expression3) --> Byte to write (0 to 255)

Page 20: QUICK REFERENCE - grifo

ITALIAN TECHNOLOGY grifo ®

Page 15 Basic - 52

OPERATOR KEYBOARD MANAGEMENT

KEYB (expression)It enables or disables the matrix keyboard scanning and reads the possible key pressed code. Thisprocedure can start or stop a periodic keyboard scanning, with a debouncing on the pressed key, orit can return the pressed key code (0 if no key is pressed) through the stack.(expression) --> 0 = Keyboard scanning OFF.

1 = Keyboard scanning ON.2 = Return the pressed key code (0 if no key is pressed) through the stack.The keyboard scanning is enabled if it was OFF.

OPERATOR DISPLAY SELECTION AND INITIALIZATION

DISPLAY (expression)It inizializes the selected display.Remember that the user must call this new instruction before usingthe output ridirection (UO1) instruction.(expression) --> 0 = FUTABA 20x2

1 = FUTABA 40x12 = FUTABA 40x23 = FUTABA 40x44 = LCD 20x25 = LCD 20x46 = LCD 40x27 = LCD 40x4

82C55 INITIALIZATION FOR CONSOLE REDIRECTION MANAGEMENT

P8255 (expression)It initializes PPI 82c55 so it can manage a user pannell. It is necessary to call it only once before touse the other user pannell instruction (KEYB,DISPLAY,UO1).(expression) --> 0 = PORT in INPUT

1 = PORT in OUTPUT

Page 21: QUICK REFERENCE - grifo

grifo ® ITALIAN TECHNOLOGY

Page 16 Basic - 52

SFR (SPECIAL FUNCTION REGISTER) READ/WRITE

RW_SFR (expression1),(expression2),(expression3)It performs a special function register (SFR) read or write operations.The user must remember that in "read procedure" the (expression3) parameter must be given evenif it has no meaning. The SFR identification byte is a numeric code, with the following meaning:

SFR NAME SFR CODE SFR NAME SFR CODEfor GPC® 552,553,554 for GPC® 323,324

CTCON 0 DPL1 0CTH3 1 DPH1 1CTH2 2 DPS 2CTH1 3 CKCON 3CTH0 4 EXIF 4CMH2 5 SCON1 5CMH1 6 SBUF1 6CMH0 7 TA 7CTL3 8 WDCON 8CTL2 9 EIE 9CTL1 10 EIP 10CTL0 11CML2 12CML1 13CML0 14IEN1 15IP1 16RTE 17S1ADR 18S1DAT 19S1STA 20S1CON 21STE 22TMH2 23TML2 24TM2CON 25TM2IR 26T3 27P4 28P5 29 (it is read only)(expression1) --> 0 to 1 = R/W selection byte (0=Reading; 1=Writing).(expression2) --> 0 to 29 = SFR identification byte.(expression3) --> 0 to 255 = Byte to write.

Page 22: QUICK REFERENCE - grifo

ITALIAN TECHNOLOGY grifo ®

Page 17 Basic - 52

REAL TIME CLOCK MANAGEMENT

GES_RTC (expression1),(expression2),(expression3),(expression4), (expression5),(expression6),(expression7),(expression8)

It initializes the RTC or return date or its time .The user must remember that in read procedure allparameters must be given even if they have no meaning.(expr1) --> 0 = Readinf of HOUR,MINUTE,SECOND.

--> 1 = Reading of DAY of WEEK, DAY, MONTH, YEAR.--> 2 = It inizializes of the RTC.

(expr2) --> Byte to write hours (0 to 23)(expr3) --> Byte to write minutes (0 to 59)(expr4) --> Byte to write seconds (0 to 59)(expr5) --> Byte to write the day of week (0 to 6)(expr6) --> Byte to write the day of month (1 to 31)(expr7) --> Byte to write month (1 to 12)(expr8) --> Byte to write year (0 to 3)

PWM LINES MANAGEMENT

SET_PWM (expression1),(expression2),(expression3)It generates PWM signals on CPU line.(expression1) --> PWM line selection(expression2) --> Frequency(expression3) --> Duty_Cycle (0 to 100%)If (expression2) and (expression3) are both set to 0 the PWM line is set and maintened at "0" logicvalue.If (expression2) and (expression3) are both set to 1 the PWM line is set and maintened at "1" logicvalue.

Page 23: QUICK REFERENCE - grifo

grifo ® ITALIAN TECHNOLOGY

Page 18 Basic - 52

Page 24: QUICK REFERENCE - grifo

ITALIAN TECHNOLOGY grifo ®

Page A-1Basic 52-Basic xxx Rel.3.00

APPENDIX A: OPERATOR INTERFACE ELECTRIC DIAGRAMAPPENDIX A: OPERATOR INTERFACE ELECTRIC DIAGRAM

FIGURE A-1: KDX X24 ELECTRIC DIAGRAM

A

A

B

B

C

C

1 1

2 2

3 3

4 4

5 5

grifo ®Title:

Date:

Page : of

Rel.

LCD20x2 LCD20x4 Futaba VFD R1= 0Ω N.M. N .M.R2= N .M. N .M. N .M.R3= 18Ω 12Ω N .M.R4= 18Ω 12Ω N.M.R5= N .M. N .M. N .M.R6= 470ΩR7= 470ΩR8= 470ΩR9= 470ΩRR1= 22KΩ 9+1 SIPRR2= 22KΩ 9+1 SIPRV1= 10KΩ trimmerC1= 100nFC2= 22µF 6,3V TantaliumC3= 100nFC4= 100nFC5= 22µF 6,3V TantaliumCN1= 2 pins mini male connectorCN2= 10 pins male st ripCN3= 20 pins male low profi le c connectorCN4= LCD L214 (20x4)CN5= Futaba VFD20x2CN6= LCD L2012 (20x2)IC1= 7407J1= 2 pins female jumper

+VLED

VFD FUTABAI/O 20 p ins

11

9-12-1998 1.2

External Keyboard 4x6

CR

LCD 20x2 LCD 20x4

PA.7PA.6PA.5PA.4PA.3PA.2PA.1PA.0

PC.2PC.1PC.0PC.3PC.4

+5VGND

N.C.N.C.

PC.5PC.6PC.7

G K7 4 1A

LH2580

MI369

NJCDEF

KDL/F-2/424

7

CN3

8

RR1

563412

1

CN5

3579

1 11 31 5

1 31 21 11 0987

1 31 61 5

1 1

1 81 7

1 29

1 4

1 0

1 8 654

654

1 72 0

1 6

1 41 0

42

821

1 6

3

21

1 6

1 51 5

3

J1

C1

C4+ C5

R1

R2

R3

R4

R5

RV1

RR2

6

+C2

1 2

R6

R7

R9

R8

4

CN2

3

2

1

8 7 6 5 9 1 0

C3

+5V

+5V

+5V

+5V

1 92 0

+5V

12

CN1

7407

2 4 6 8 1 0 1 2

1 3 5 9 1 1 1 3

1 4

7 IC1

1 4

CN6

1 31 21 11 0

987

1 4

CN4

RR2

/BUSY

EER/WR/WRSRS

GND

Contrast

+5V

/SEL

/WR

TEST

D6D6

D5

D5

D5

D4

D4

D4

D3

D3

D3

D1

D1

D1

D0

D0

D0

D7D7

D2

D2

D2

Page 25: QUICK REFERENCE - grifo

grifo ® ITALIAN TECHNOLOGY

Page A-2 Basic 52-Basic xxx Rel.3.00

FIGURE A-2: QTP 24P ELECTRIC DIAGRAM PART 1

A

A

B

B

C

C

1 1

2 2

3 3

4 4

5 5

grifo ®Title:

Date:

Page : of

Rel.

1 2 3 4

5 6 7 8

9 0ESC ENTER

QTP 24

ALD5

BLD6

CLD7

DLD8

ELD9

FLD10

GLD11

HLD12

ILD13

JLD14

KLD15

LLD16

LD1

LD2

LD3

LD4

1.2

I/O 20 p ins VFD FUTABA

QTP 24 keyboard 4x6

L

K

J

AEI281

BF395

CG

H

40Esc

D6Enter7

LCD 20x4LCD 20x2

PA.7PA.6PA.5PA.4PA.3PA.2PA.1PA.0

PC.2PC.1PC.0PC.3PC.4

+5VGND

N.C.N.C.

PC.4

PC.5PC.6PC.7

QTP 24P

1 2

22-07-1998

7

CN2

8

RR1

563412

1

CN5

3579

1 11 31 5

1 4

CN6

1 31 21 11 0

987

1 31 61 5

1 1

1 81 7

1 1

1 29

1 4

1 0

1 8 654

654

2 0

1 6

1 41 0

4

821

1 6

3

21

1 51 5

3

C9

C13+

C12

R7

R6

R5

RV1

RR2

+C10

1 2

R8

R9

R10

R11

1 0

CN3

9

8

7

6 5 4 3 2 1

C3

+5V

+5V

+5V

+5V

1 92 0

+5V

7407

8 6 1 0 4 1 2 2

9 5 1 1 3 1 3 1

1 4

7 IC3

1 4

CN4

1 7

J1

6

2

RR2

J2

1 21 11 0

987

1 3

1 6

D6D7

/BUSY

EE

CLK

/WRRSRS

Contrast

+VLED

/SEL

TEST

D0

Col.6

Col.6

D1

Col.4

Col.4

Col.5

Col.5

D2D3

Col3

D4

Col.2

Col.2

D5

Col.1

Col.1

SD

R/W R/W

Metal Panel

Col.3

Page 26: QUICK REFERENCE - grifo

ITALIAN TECHNOLOGY grifo ®

Page A-3Basic 52-Basic xxx Rel.3.00

FIGURE A-3: QTP 24P ELECTRIC DIAGRAM PART 2

A

A

B

B

C

C

1 1

2 2

3 3

4 4

5 5

grifo ®Title:

Date:

Page : of

Rel.

22

1.2

QTP 24P

22-07-1998

LD1

LD2

LD3

LD4

LD5

LD16

LD15

LD14

LD13

LD12

LD11

LD10

LD9

LD8

LD7

LD6

D4 D3+5V

R3R4

R1

+5V

C2

+5V

C4

3

CN1

4

8÷24Vac

PD1

+ C8+ C7

+C11

+C5

+5V

16

15

1

13

14

12

11

10

9

8

7

6

5

4

3

2

28

27

26

25

2423222120191817

M 5 4 8 0

IC2SWITCHING

REGOLATOR

IC1

CLK

SD

Page 27: QUICK REFERENCE - grifo

grifo ® ITALIAN TECHNOLOGY

Page A-4 Basic 52-Basic xxx Rel.3.00

FIGURE A-4: QTP 16P ELECTRIC DIAGRAM

A

A

B

B

C

C

1 1

2 2

3 3

4 4

5 5

grifo ®Title:

Date:

Page : of

Rel.

1 2 3 4 5 6 7 8

1 2 3 A4 5 6 B7 8 9 C* 0 # D1 2 3 4

5

6

78

22 -07 -98 1.2

Standard I/O 20 p in connector DISPLAY 4x20DISPLAY 2x20

Keyboard connector

DC Power supply

AC Power supply

OPTIONAL

MatrixKeyboard 4x4

* 7

#

A

28

1

B

39

5

C

4

0

D

6

PA.7PA.6PA.5PA.4PA.3PA.2PA.1PA.0

PC.2PC.1PC.0PC.3

+5VGND

N.C.N.C.

PC.4PC.5PC.6PC.7

QTP 16P

1 1

7

CN4

8

RR1

563412

1 4

CN1

1 31 21 11 0

987

1 31 61 5

1 81 7

1 11 29

1 4

1 0

654

654

21

1 6

3

21

1 51 5

3

C1

R7

R6

R5

R4

4

CN3

3

3

2

8 7 6 5

C5

+5V

+5V

+5V

1 92 0

+5V

J1

1 0987

1 3

RR2

R1

R2

R3

+5V

C2

1 21 1

RR2

+5V

1

2

A

B

3

CN5

4

+-

~

~

PD1

C3+

C4 C6+

C9 C8+

C7

TZ1

L1

A

B

1 4

CN2

RV1

1 6

SN7407

2 4 6 8 1 0 1 2

1 3 5 9 1 1 1 3

1 4

7

+5V

SWITCHING

REGOLATOR

D6D7

R/W R/WRS RS

Contrast

E E

D0

D0D0

D2.

D2D2

D1

D1D1

D3

D3D3D4D5

Page 28: QUICK REFERENCE - grifo

ITALIAN TECHNOLOGY grifo ®

Page A-5Basic 52-Basic xxx Rel.3.00

FIGURE A-5: PPI 82C55 ELECTRIC DIAGRAM

A

A

B

B

C

C

D

D

1 1

2 2

3 3

4 4

5 5

6 6

grifo ®Title:

Date:

Page : of

Rel.16/11/1998

ABACO® I/O BUS26 pin connector

A0A1

/RST/RD/WR

Standard I/O20 pin connector

+5V

GND

40 pin Dip

PB.6PB.5PB.4PB.3PB.2PB.1PB.0

PB.7

Power supply

Gnd

+5v

Dip Switch

Standard I/O20 pin connector

Gnd

+Vcc

/CS2/CS1/NMI/INT

/IRQ

D0D1D2D3D4D5D6D7

A2A3A4A5A6A7

N.C.N.C.

PA.7PA.6PA.5PA.4PA.3PA.2PA.1PA.0

PC.2PC.1PC.0

PC.3

+5V

GND

PC.4PC.5PC.6PC.7

1.1

PPI example

1 1

1

23a

74HCT00

10K

10K

1N

41

48

2 1

+5V

7

8563412

131615

18

17

1112

9

14

10

1920

100n

F+22µF

+5V

+5V

100nF

161514131211

87654321

19

23242122

26

2510

0nF

+22µF

+5V

D0D1D2D3D4D5D6D7

10K+5V

654321

+5V

10K

10K

+5V

+22µF

100n

F

100n

F

100n

F

/G

P0P1P2P3P4P5P6P7

/P=Q

Q0Q1Q2Q3Q4Q5Q6Q7

1

2468

11131517

19

357912141618

74LS688

/GDIRA1A2A3A4A5A6A7A8

B1B2B3B4B5B6B7B8

191

23456789

1817161514131211

74LS245

9

108c 74HCT00

12

1311d 74HCT00

+5V

1

D0D1D2D3D4D5D6D7

A0A1

/CS

/RD

/WR

RESET

PB0PB1PB2PB3PB4PB5PB6PB7

PC0PC1PC2PC3PC4PC5PC6PC7

PA0PA1PA2PA3PA4PA5PA6PA7

Vcc

Gnd

8 2 c 5 5

3433323130292827

98

6

5

36

35

1819202122232425

1415161713121110

432140393837

26

7

7

8563412

4

56b

74HCT00

10K

+5V10

K +5V

10K+5V

18

17

100n

F

+22µF

+5V

171820

A0A1

+5V

10K

/G1/G2A1A2A3A4A5A6A7A8

Y1Y2Y3Y4Y5Y6Y7Y8

119

23456789

1817161514131211

74LS54110K

+5V

A0A1

D0D1D2D3D4D5D6D7

109

N.C.N.C.N.C.N.C.

/RD

/RD

/WR

/WR

/CS

/CS

/CS

RES

RES

/RES

/RST

/RST

BA2BA3

BA5

BA7BA6

BA4

/BIRQ

BD0

BD2

BD7BD6BD5BD4BD3

BD1

/BRD

BA1BA0/BWR

/BRST

Page 29: QUICK REFERENCE - grifo

grifo ® ITALIAN TECHNOLOGY

Page A-6 Basic 52-Basic xxx Rel.3.00