+ __CONFIG _XT_OSC & _WDT_OFF & _PWRTE_ON & _CP_OFF
+
+;********************************************************************************
+
+;Set aside memory locations for variables
+DELAYTEMP EQU 12
+DELAYTEMP2 EQU 13
+DIREZIONE EQU 16
+SYSWAITTEMPMS EQU 14
+SYSWAITTEMPMS_H EQU 15
+
+;********************************************************************************
+
+;Vectors
+ ORG 0
+ pagesel BASPROGRAMSTART
+ goto BASPROGRAMSTART
+ ORG 4
+ retfie
+
+;********************************************************************************
+
+;Start of program memory page 0
+ ORG 5
+BASPROGRAMSTART
+;Call initialisation routines
+ call INITSYS
+
+;Start of the main program
+;Source:F1L29S0I29
+ banksel TRISB
+ clrf TRISB
+;Source:F1L30S0I30
+STARTUP
+;Source:F1L33S0I33
+ movlw 1
+ banksel DIREZIONE
+ movwf DIREZIONE
+;Source:F1L34S0I34
+ movlw 1
+ movwf PORTB
+LOOP
+;Source:F1L37S0I37
+SysDoLoop_S1
+;Source:F1L38S0I38
+ decf DIREZIONE,W
+ btfss STATUS, Z
+ goto ELSE1_1
+;Source:F1L39S0I39
+ rlf PORTB,F
+;Source:F1L40S0I40
+ movlw 64
+ subwf PORTB,W
+ btfsc STATUS, C
+ clrf DIREZIONE
+ENDIF2
+;Source:F1L41S0I41
+ goto ENDIF1
+ELSE1_1
+;Source:F1L42S0I42
+ rrf PORTB,F
+;Source:F1L43S0I43
+ movf PORTB,W
+ sublw 1
+ btfss STATUS, C
+ goto ENDIF3
+ movlw 1
+ movwf DIREZIONE
+ENDIF3
+;Source:F1L44S0I44
+ENDIF1
+;Source:F1L45S0I45
+ movlw 250
+ movwf SysWaitTempMS
+ clrf SysWaitTempMS_H
+ call Delay_MS
+;Source:F1L46S0I46
+ goto SysDoLoop_S1
+SysDoLoop_E1
+;Source:F2L153S0I153
+;Source:F2L154S0I154
+;Source:F2L158S0I158
+;Source:F2L164S0I164
+;Source:F2L169S0I169
+;Source:F2L171S0I171
+;Source:F2L172S0I172
+;Source:F2L173S0I173
+;Source:F2L174S0I174
+;Source:F2L176S0I176
+;Source:F2L179S0I179
+;Source:F2L180S0I180
+;Source:F2L181S0I181
+;Source:F2L182S0I182
+;Source:F2L186S0I186
+;Source:F2L187S0I187
+;Source:F2L188S0I188
+;Source:F2L189S0I189
+;Source:F2L190S0I190
+;Source:F2L191S0I191
+;Source:F2L192S0I192
+;Source:F2L193S0I193
+;Source:F2L194S0I194
+;Source:F2L195S0I195
+;Source:F2L196S0I196
+;Source:F2L197S0I197
+;Source:F2L198S0I198
+;Source:F2L199S0I199
+;Source:F2L200S0I200
+;Source:F2L201S0I201
+;Source:F2L202S0I202
+;Source:F2L203S0I203
+;Source:F2L204S0I204
+;Source:F2L205S0I205
+;Source:F2L206S0I206
+;Source:F2L207S0I207
+;Source:F2L208S0I208
+;Source:F2L209S0I209
+;Source:F2L210S0I210
+;Source:F2L211S0I211
+;Source:F2L212S0I212
+;Source:F2L213S0I213
+;Source:F2L214S0I214
+;Source:F2L215S0I215
+;Source:F2L216S0I216
+;Source:F2L217S0I217
+;Source:F2L218S0I218
+;Source:F2L219S0I219
+;Source:F2L220S0I220
+;Source:F2L222S0I222
+;Source:F2L223S0I223
+;Source:F2L224S0I224
+;Source:F2L225S0I225
+;Source:F2L226S0I226
+;Source:F2L227S0I227
+;Source:F2L228S0I228
+;Source:F2L229S0I229
+;Source:F2L230S0I230
+;Source:F2L231S0I231
+;Source:F2L232S0I232
+;Source:F2L233S0I233
+;Source:F2L234S0I234
+;Source:F2L235S0I235
+;Source:F2L236S0I236
+;Source:F2L237S0I237
+;Source:F2L238S0I238
+;Source:F2L239S0I239
+;Source:F2L240S0I240
+;Source:F2L241S0I241
+;Source:F2L242S0I242
+;Source:F2L243S0I243
+;Source:F2L244S0I244
+;Source:F2L245S0I245
+;Source:F2L246S0I246
+;Source:F2L247S0I247
+;Source:F2L248S0I248
+;Source:F2L249S0I249
+;Source:F2L250S0I250
+;Source:F2L251S0I251
+;Source:F2L252S0I252
+;Source:F2L253S0I253
+;Source:F2L254S0I254
+;Source:F2L255S0I255
+;Source:F2L256S0I256
+;Source:F2L259S0I259
+;Source:F2L260S0I260
+;Source:F2L261S0I261
+;Source:F2L262S0I262
+;Source:F2L263S0I263
+;Source:F2L264S0I264
+;Source:F2L265S0I265
+;Source:F2L266S0I266
+;Source:F2L267S0I267
+;Source:F2L268S0I268
+;Source:F2L269S0I269
+;Source:F2L270S0I270
+;Source:F2L271S0I271
+;Source:F2L272S0I272
+;Source:F2L274S0I274
+;Source:F2L275S0I275
+;Source:F2L276S0I276
+;Source:F2L277S0I277
+;Source:F2L278S0I278
+;Source:F2L279S0I279
+;Source:F2L280S0I280
+;Source:F2L281S0I281
+;Source:F2L282S0I282
+;Source:F2L283S0I283
+;Source:F2L284S0I284
+;Source:F2L285S0I285
+;Source:F2L286S0I286
+;Source:F2L287S0I287
+;Source:F2L288S0I288
+;Source:F2L289S0I289
+;Source:F2L290S0I290
+;Source:F2L291S0I291
+;Source:F2L292S0I292
+;Source:F2L293S0I293
+;Source:F2L294S0I294
+;Source:F2L295S0I295
+;Source:F2L296S0I296
+;Source:F2L297S0I297
+;Source:F2L298S0I298
+;Source:F2L299S0I299
+;Source:F2L300S0I300
+;Source:F2L301S0I301
+;Source:F2L302S0I302
+;Source:F2L303S0I303
+;Source:F2L304S0I304
+;Source:F2L305S0I305
+;Source:F2L306S0I306
+;Source:F2L307S0I307
+;Source:F2L308S0I308
+;Source:F2L309S0I309
+;Source:F2L312S0I312
+;Source:F2L313S0I313
+;Source:F2L314S0I314
+;Source:F2L315S0I315
+;Source:F2L316S0I316
+;Source:F2L317S0I317
+;Source:F2L318S0I318
+;Source:F2L319S0I319
+;Source:F2L320S0I320
+;Source:F2L321S0I321
+;Source:F2L322S0I322
+;Source:F2L323S0I323
+;Source:F2L324S0I324
+;Source:F2L325S0I325
+;Source:F2L326S0I326
+;Source:F2L327S0I327
+;Source:F2L328S0I328
+;Source:F2L329S0I329
+;Source:F2L330S0I330
+;Source:F2L331S0I331
+;Source:F2L332S0I332
+;Source:F2L333S0I333
+;Source:F2L334S0I334
+;Source:F2L335S0I335
+;Source:F2L336S0I336
+;Source:F2L337S0I337
+;Source:F2L338S0I338
+;Source:F2L339S0I339
+;Source:F2L340S0I340
+;Source:F2L341S0I341
+;Source:F2L342S0I342
+;Source:F2L343S0I343
+;Source:F2L344S0I344
+;Source:F2L345S0I345
+;Source:F2L346S0I346
+;Source:F2L2362S0I40
+;Source:F2L2363S0I41
+;Source:F3L128S0I128
+;Source:F3L129S0I129
+;Source:F3L130S0I130
+;Source:F3L131S0I131
+;Source:F3L133S0I133
+;Source:F3L139S0I139
+;Source:F3L140S0I140
+;Source:F3L141S0I141
+;Source:F3L142S0I142
+;Source:F3L143S0I143
+;Source:F3L144S0I144
+;Source:F3L145S0I145
+;Source:F3L146S0I146
+;Source:F3L148S0I148
+;Source:F3L149S0I149
+;Source:F3L150S0I150
+;Source:F3L151S0I151
+;Source:F3L152S0I152
+;Source:F3L154S0I154
+;Source:F3L155S0I155
+;Source:F3L156S0I156
+;Source:F3L157S0I157
+;Source:F3L158S0I158
+;Source:F3L159S0I159
+;Source:F3L160S0I160
+;Source:F3L161S0I161
+;Source:F3L163S0I163
+;Source:F3L164S0I164
+;Source:F3L165S0I165
+;Source:F3L2178S0I1991
+;Source:F3L2466S0I101
+;Source:F3L2686S0I32
+;Source:F3L4996S0I160
+;Source:F4L58S0I58
+;Source:F4L59S0I59
+;Source:F4L60S0I60
+;Source:F4L63S0I63
+;Source:F4L64S0I64
+;Source:F4L67S0I67
+;Source:F4L69S0I69
+;Source:F4L118S0I118
+;Source:F5L150S0I84
+;Source:F6L25S0I25
+;Source:F6L26S0I26
+;Source:F6L54S0I23
+;Source:F7L41S0I41
+;Source:F7L42S0I42
+;Source:F7L43S0I43
+;Source:F7L44S0I44
+;Source:F7L45S0I45
+;Source:F7L46S0I46
+;Source:F7L47S0I47
+;Source:F7L49S0I49
+;Source:F7L52S0I52
+;Source:F7L53S0I53
+;Source:F7L54S0I54
+;Source:F7L247S0I21
+;Source:F9L166S0I166
+;Source:F9L169S0I169
+;Source:F9L170S0I170
+;Source:F9L173S0I173
+;Source:F9L174S0I174
+;Source:F9L176S0I176
+;Source:F9L177S0I177
+;Source:F9L179S0I179
+;Source:F9L181S0I181
+;Source:F9L182S0I182
+;Source:F9L183S0I183
+;Source:F9L184S0I184
+;Source:F9L186S0I186
+;Source:F9L187S0I187
+;Source:F9L188S0I188
+;Source:F9L190S0I190
+;Source:F9L194S0I194
+;Source:F9L196S0I196
+;Source:F9L197S0I197
+;Source:F9L198S0I198
+;Source:F9L199S0I199
+;Source:F9L202S0I202
+;Source:F9L203S0I203
+;Source:F9L205S0I205
+;Source:F9L206S0I206
+;Source:F9L207S0I207
+;Source:F9L209S0I209
+;Source:F9L210S0I210
+;Source:F9L212S0I212
+;Source:F9L213S0I213
+;Source:F9L216S0I216
+;Source:F9L217S0I217
+;Source:F9L220S0I220
+;Source:F9L224S0I224
+;Source:F9L225S0I225
+;Source:F9L362S0I9
+;Source:F9L363S0I10
+;Source:F10L34S0I34
+;Source:F10L35S0I35
+;Source:F10L36S0I36
+;Source:F10L37S0I37
+;Source:F10L38S0I38
+;Source:F10L39S0I39
+;Source:F10L40S0I40
+;Source:F10L41S0I41
+;Source:F11L151S0I151
+;Source:F11L262S0I262
+;Source:F11L263S0I263
+;Source:F11L264S0I264
+;Source:F11L318S0I318
+;Source:F11L319S0I319
+;Source:F11L320S0I320
+;Source:F11L321S0I321
+;Source:F11L322S0I322
+;Source:F11L323S0I323
+;Source:F11L325S0I325
+;Source:F11L326S0I326
+;Source:F11L327S0I327
+;Source:F11L328S0I328
+;Source:F11L329S0I329
+;Source:F11L330S0I330
+;Source:F11L332S0I332
+;Source:F11L333S0I333
+;Source:F11L334S0I334
+;Source:F11L335S0I335
+;Source:F11L336S0I336
+;Source:F11L337S0I337
+;Source:F11L339S0I339
+;Source:F11L340S0I340
+;Source:F11L341S0I341
+;Source:F11L342S0I342
+;Source:F11L343S0I343
+;Source:F11L344S0I344
+;Source:F11L346S0I346
+;Source:F11L347S0I347
+;Source:F11L348S0I348
+;Source:F11L349S0I349
+;Source:F11L350S0I350
+;Source:F11L351S0I351
+;Source:F11L353S0I353
+;Source:F11L354S0I354
+;Source:F11L355S0I355
+;Source:F11L356S0I356
+;Source:F11L357S0I357
+;Source:F11L358S0I358
+;Source:F11L363S0I363
+;Source:F11L364S0I364
+;Source:F11L365S0I365
+;Source:F11L367S0I367
+;Source:F11L368S0I368
+;Source:F11L369S0I369
+;Source:F11L370S0I370
+;Source:F11L372S0I372
+;Source:F11L374S0I374
+;Source:F11L376S0I376
+;Source:F11L377S0I377
+;Source:F11L378S0I378
+;Source:F11L379S0I379
+;Source:F11L380S0I380
+;Source:F11L381S0I381
+;Source:F11L382S0I382
+;Source:F11L383S0I383
+;Source:F11L384S0I384
+;Source:F11L385S0I385
+;Source:F11L386S0I386
+;Source:F11L387S0I387
+;Source:F11L388S0I388
+;Source:F11L389S0I389
+;Source:F11L390S0I390
+;Source:F11L391S0I391
+;Source:F11L393S0I393
+;Source:F11L394S0I394
+;Source:F11L395S0I395
+;Source:F11L396S0I396
+;Source:F11L397S0I397
+;Source:F11L398S0I398
+;Source:F11L399S0I399
+;Source:F11L400S0I400
+;Source:F11L401S0I401
+;Source:F11L402S0I402
+;Source:F11L403S0I403
+;Source:F11L404S0I404
+;Source:F11L405S0I405
+;Source:F11L406S0I406
+;Source:F11L407S0I407
+;Source:F11L408S0I408
+;Source:F11L412S0I412
+;Source:F11L413S0I413
+;Source:F11L414S0I414
+;Source:F11L415S0I415
+;Source:F11L416S0I416
+;Source:F11L417S0I417
+;Source:F11L418S0I418
+;Source:F11L419S0I419
+;Source:F11L420S0I420
+;Source:F11L421S0I421
+;Source:F11L422S0I422
+;Source:F11L423S0I423
+;Source:F11L424S0I424
+;Source:F11L425S0I425
+;Source:F11L426S0I426
+;Source:F11L427S0I427
+;Source:F11L431S0I431
+;Source:F11L432S0I432
+;Source:F11L433S0I433
+;Source:F11L434S0I434
+;Source:F11L435S0I435
+;Source:F11L436S0I436
+;Source:F11L437S0I437
+;Source:F11L438S0I438
+;Source:F11L439S0I439
+;Source:F11L440S0I440
+;Source:F11L441S0I441
+;Source:F11L442S0I442
+;Source:F11L443S0I443
+;Source:F11L503S0I503
+;Source:F11L504S0I504
+;Source:F11L506S0I506
+;Source:F11L507S0I507
+;Source:F11L509S0I509
+;Source:F11L510S0I510
+;Source:F11L512S0I512
+;Source:F11L513S0I513
+;Source:F11L515S0I515
+;Source:F11L516S0I516
+;Source:F11L518S0I518
+;Source:F11L519S0I519
+;Source:F11L531S0I531
+;Source:F11L532S0I532
+;Source:F11L533S0I533
+;Source:F11L534S0I534
+;Source:F11L535S0I535
+;Source:F11L536S0I536
+;Source:F11L537S0I537
+;Source:F11L538S0I538
+;Source:F11L541S0I541
+;Source:F11L542S0I542
+;Source:F11L543S0I543
+;Source:F11L544S0I544
+;Source:F11L547S0I547
+;Source:F11L548S0I548
+;Source:F11L549S0I549
+;Source:F11L550S0I550
+;Source:F11L553S0I553
+;Source:F11L554S0I554
+;Source:F11L555S0I555
+;Source:F11L556S0I556
+;Source:F11L559S0I559
+;Source:F11L560S0I560
+;Source:F11L561S0I561
+;Source:F11L562S0I562
+;Source:F11L673S0I673
+;Source:F11L674S0I674
+;Source:F11L675S0I675
+;Source:F11L676S0I676
+;Source:F11L679S0I679
+;Source:F11L680S0I680
+;Source:F11L681S0I681
+;Source:F11L682S0I682
+;Source:F12L62S0I62
+;Source:F12L63S0I63
+;Source:F12L64S0I64
+;Source:F12L65S0I65
+;Source:F12L68S0I68
+;Source:F12L69S0I69
+;Source:F12L70S0I70
+;Source:F12L71S0I71
+;Source:F12L72S0I72
+;Source:F12L75S0I75
+;Source:F13L42S0I42
+;Source:F13L43S0I43
+;Source:F13L44S0I44
+;Source:F13L45S0I45
+;Source:F13L46S0I46
+;Source:F13L50S0I50
+;Source:F13L51S0I51
+;Source:F13L52S0I52
+;Source:F13L53S0I53
+;Source:F13L56S0I56
+;Source:F13L57S0I57
+;Source:F13L58S0I58
+;Source:F13L59S0I59
+;Source:F13L60S0I60
+;Source:F13L61S0I61
+;Source:F13L62S0I62
+;Source:F13L63S0I63
+;Source:F13L64S0I64
+;Source:F13L66S0I66
+;Source:F13L495S0I11
+;Source:F14L57S0I57
+;Source:F14L64S0I64
+;Source:F14L66S0I66
+;Source:F14L67S0I67
+;Source:F14L68S0I68
+;Source:F14L69S0I69
+;Source:F14L70S0I70
+;Source:F14L71S0I71
+;Source:F14L72S0I72
+;Source:F15L22S0I22
+;Source:F15L25S0I25
+;Source:F16L298S0I60
+;Source:F17L92S0I92
+;Source:F17L95S0I95
+;Source:F17L98S0I98
+;Source:F18L136S0I136
+;Source:F18L137S0I137
+;Source:F18L138S0I138
+;Source:F18L139S0I139
+;Source:F18L143S0I143
+;Source:F18L144S0I144
+;Source:F18L145S0I145
+;Source:F18L146S0I146
+;Source:F18L148S0I148
+;Source:F18L149S0I149
+;Source:F18L150S0I150
+;Source:F18L155S0I155
+;Source:F18L157S0I157
+;Source:F18L158S0I158
+;Source:F19L61S0I61
+;Source:F19L89S0I89
+;Source:F19L92S0I92
+;Source:F19L93S0I93
+;Source:F19L95S0I95
+;Source:F19L96S0I96
+;Source:F19L97S0I97
+;Source:F19L98S0I98
+;Source:F19L99S0I99
+;Source:F19L101S0I101
+;Source:F19L102S0I102
+;Source:F19L103S0I103
+;Source:F19L104S0I104
+;Source:F19L384S0I19
+;Source:F19L470S0I56
+;Source:F19L683S0I16
+;Source:F19L684S0I17
+;Source:F19L685S0I18
+;Source:F19L687S0I20
+;Source:F19L688S0I21
+;Source:F19L689S0I22
+;Source:F19L690S0I23
+;Source:F19L691S0I24
+;Source:F19L692S0I25
+;Source:F19L693S0I26
+;Source:F19L694S0I27
+;Source:F19L695S0I28
+;Source:F19L697S0I30
+;Source:F19L698S0I31
+;Source:F19L699S0I32
+;Source:F19L700S0I33
+;Source:F19L701S0I34
+;Source:F19L702S0I35
+;Source:F19L703S0I36
+;Source:F19L704S0I37
+;Source:F19L705S0I38
+;Source:F19L706S0I39
+;Source:F19L708S0I41
+;Source:F19L710S0I43
+;Source:F19L711S0I44
+;Source:F19L712S0I45
+;Source:F19L714S0I47
+;Source:F20L42S0I42
+;Source:F20L43S0I43
+;Source:F20L44S0I44
+;Source:F20L45S0I45
+;Source:F20L46S0I46
+;Source:F20L47S0I47
+;Source:F20L48S0I48
+;Source:F20L49S0I49
+;Source:F20L50S0I50
+;Source:F20L51S0I51
+;Source:F20L52S0I52
+;Source:F20L53S0I53
+;Source:F20L57S0I57
+;Source:F20L58S0I58
+;Source:F21L150S0I150
+;Source:F21L151S0I151
+;Source:F21L152S0I152
+BASPROGRAMEND
+ sleep
+ goto BASPROGRAMEND
+
+;********************************************************************************
+
+Delay_MS
+ incf SysWaitTempMS_H, F
+DMS_START
+ movlw 142
+ movwf DELAYTEMP2
+DMS_OUTER
+ movlw 1
+ movwf DELAYTEMP
+DMS_INNER
+ decfsz DELAYTEMP, F
+ goto DMS_INNER
+ decfsz DELAYTEMP2, F
+ goto DMS_OUTER
+ decfsz SysWaitTempMS, F
+ goto DMS_START
+ decfsz SysWaitTempMS_H, F
+ goto DMS_START
+ return
+
+;********************************************************************************
+
+INITSYS
+;Source:F12L948S167I852
+ clrf PORTA
+;Source:F12L951S167I855
+ clrf PORTB
+ return
+
+;********************************************************************************
+
+
+ END
diff --git a/trunk/workspace/gcb/16c84-knight.gcb b/trunk/workspace/gcb/16c84-knight.gcb
new file mode 100644
index 00000000..99ed1c59
--- /dev/null
+++ b/trunk/workspace/gcb/16c84-knight.gcb
@@ -0,0 +1,46 @@
+' ########### start ###########
+' pic:PIC16C84
+' ########### end ###########
+'
+' ******************************************************************
+' Knight Rider with a PIC16C84
+' 2014-08-18 (c) Paolo Iocco#
+' ******************************************************************
+'
+' Circuit diagram
+' ---------------
+' +--\/--+
+' nc-----|1° 18|-----nc
+' nc-----|2 17|-----nc
+' nc-----|3 16|<--------H
+' +5V--|50K|-->|4 15|<--------H = 4 MHz chrystal+ capacitors
+' GND-------->|5 14|<--------+5V
+' LED<--------|6 13|-------->LED
+' LED<--------|7 12|-------->LED
+' LED<--------|8 11|-------->LED
+' LED<--------|9 10|-------->LED
+' +------+
+'
+' ******************************************************************
+
+#Chip 16C84, 4
+#Config OSC = XT, WDT = OFF, PWRTE = ON, CP = OFF
+
+dir PORTB out
+dim direzione as byte
+
+Startup:
+direzione = 1
+PORTB = 1
+
+Loop:
+do
+ if direzione=1 then
+ Rotate PORTB left
+ if PORTB >= 64 then direzione = 0
+ else
+ Rotate PORTB right
+ if PORTB <= 1 then direzione = 1
+ end if
+ Wait 250 ms
+loop
diff --git a/trunk/workspace/gcb/16c84-knight.hex b/trunk/workspace/gcb/16c84-knight.hex
new file mode 100644
index 00000000..d955a166
--- /dev/null
+++ b/trunk/workspace/gcb/16c84-knight.hex
@@ -0,0 +1,11 @@
+:020000040000FA
+:020000000528D1
+:1000080009003220831686010130831290000130E6
+:1000180086001003031D1628860D403006020318BB
+:1000280090011D28860C0608013C031C1D28013080
+:100038009000FA308E008F0124200D2863002228BA
+:100048008F0A8E308D0001308C008C0B29288D0B87
+:1000580027288E0B25288F0B252808008501860167
+:0200680008008E
+:02400E00F93F78
+:00000001FF
diff --git a/trunk/workspace/gcb/16c84-knight.html b/trunk/workspace/gcb/16c84-knight.html
new file mode 100644
index 00000000..d1aa038b
--- /dev/null
+++ b/trunk/workspace/gcb/16c84-knight.html
@@ -0,0 +1,29 @@
+
+
+
+Compilation Report
+
+
+Compilation Report
+Compiler Version (YYYY-MM-DD): 0.98.04 2018-10-20 (Windows 32 bit)
+Compilation time
+ (Compile time: 1.34375 seconds)
+ (Assembly time: 0.00390625 seconds)
+ (Download time: 0 seconds)
+ (Total time: 1.347656 seconds)
+Chip resource usage:
+Chip Model: 16C84
+Program Memory: 50/1024 words (4,88%)
+RAM: 1/36 bytes (2,78%)
+RAM Allocation
+
+Subroutines
+
+| Name | Code Size (lines) | Compiled Size (words) | Outgoing calls |
+| Main | 21 | 33 | Delay_MS(1), INITSYS(1) |
+| INITSYS | 674 | 3 | |
+| Delay_MS | 0 | 14 | |
+
+
+
diff --git a/trunk/workspace/gcb/16c84-knight.lst b/trunk/workspace/gcb/16c84-knight.lst
new file mode 100644
index 00000000..2ab12099
--- /dev/null
+++ b/trunk/workspace/gcb/16c84-knight.lst
@@ -0,0 +1,159 @@
+GCASM List File (GCBASIC 0.98.04 2018-10-20 (Windows 32 bit))
+
+Symbols:
+A EQU 0
+ACCESS EQU 0
+B EQU 1
+BANKED EQU 1
+BASPROGRAMEND EQU 34
+BASPROGRAMSTART EQU 5
+C EQU 0
+DC EQU 1
+DELAYTEMP EQU 12
+DELAYTEMP2 EQU 13
+DELAY_MS EQU 36
+DIREZIONE EQU 16
+DMS_INNER EQU 41
+DMS_OUTER EQU 39
+DMS_START EQU 37
+EEADR EQU 9
+EECON1 EQU 136
+EECON2 EQU 137
+EEDATA EQU 8
+EEIE EQU 6
+EEIF EQU 4
+ELSE1_1 EQU 22
+ENDIF1 EQU 29
+ENDIF2 EQU 21
+ENDIF3 EQU 29
+F EQU 1
+FSR EQU 4
+GIE EQU 7
+INDF EQU 0
+INITSYS EQU 50
+INTCON EQU 11
+INTE EQU 4
+INTEDG EQU 6
+INTF EQU 1
+IRP EQU 7
+LOOP EQU 13
+NOT_PD EQU 3
+NOT_RBPU EQU 7
+NOT_TO EQU 4
+OPTION_REG EQU 129
+PCL EQU 2
+PCLATH EQU 10
+PORTA EQU 5
+PORTB EQU 6
+PS0 EQU 0
+PS1 EQU 1
+PS2 EQU 2
+PSA EQU 3
+RBIE EQU 3
+RBIF EQU 0
+RD EQU 0
+RP0 EQU 5
+RP1 EQU 6
+STARTUP EQU 8
+STATUS EQU 3
+SYSDOLOOP_E1 EQU 34
+SYSDOLOOP_S1 EQU 13
+SYSWAITTEMPMS EQU 14
+SYSWAITTEMPMS_H EQU 15
+T0CS EQU 5
+T0IE EQU 5
+T0IF EQU 2
+T0SE EQU 4
+TMR0 EQU 1
+TRISA EQU 133
+TRISB EQU 134
+W EQU 0
+WR EQU 1
+WREN EQU 2
+WRERR EQU 3
+Z EQU 2
+
+Code:
+Loc Obj Code Original Assembly
+
+
+
+
+
+
+000000 2805 GOTO BASPROGRAMSTART
+
+000004 0009 RETFIE
+
+
+
+ BASPROGRAMSTART
+000005 2032 CALL INITSYS
+
+000000 1683 BANKSEL TRISB
+000007 0186 CLRF TRISB
+ STARTUP
+000008 3001 MOVLW 1
+000000 1283 BANKSEL DIREZIONE
+00000A 0090 MOVWF DIREZIONE
+00000B 3001 MOVLW 1
+00000C 0086 MOVWF PORTB
+ LOOP
+ SYSDOLOOP_S1
+00000D 0310 DECF DIREZIONE,W
+00000E 1D03 BTFSS STATUS, Z
+00000F 2816 GOTO ELSE1_1
+000010 0D86 RLF PORTB,F
+000011 3040 MOVLW 64
+000012 0206 SUBWF PORTB,W
+000013 1803 BTFSC STATUS, C
+000014 0190 CLRF DIREZIONE
+ ENDIF2
+000015 281D GOTO ENDIF1
+ ELSE1_1
+000016 0C86 RRF PORTB,F
+000017 0806 MOVF PORTB,W
+000018 3C01 SUBLW 1
+000019 1C03 BTFSS STATUS, C
+00001A 281D GOTO ENDIF3
+00001B 3001 MOVLW 1
+00001C 0090 MOVWF DIREZIONE
+ ENDIF3
+ ENDIF1
+00001D 30FA MOVLW 250
+00001E 008E MOVWF SYSWAITTEMPMS
+00001F 018F CLRF SYSWAITTEMPMS_H
+000020 2024 CALL DELAY_MS
+000021 280D GOTO SYSDOLOOP_S1
+ SYSDOLOOP_E1
+ BASPROGRAMEND
+000022 0063 SLEEP
+000023 2822 GOTO BASPROGRAMEND
+
+
+ DELAY_MS
+000024 0A8F INCF SYSWAITTEMPMS_H, F
+ DMS_START
+000025 308E MOVLW 142
+000026 008D MOVWF DELAYTEMP2
+ DMS_OUTER
+000027 3001 MOVLW 1
+000028 008C MOVWF DELAYTEMP
+ DMS_INNER
+000029 0B8C DECFSZ DELAYTEMP, F
+00002A 2829 GOTO DMS_INNER
+00002B 0B8D DECFSZ DELAYTEMP2, F
+00002C 2827 GOTO DMS_OUTER
+00002D 0B8E DECFSZ SYSWAITTEMPMS, F
+00002E 2825 GOTO DMS_START
+00002F 0B8F DECFSZ SYSWAITTEMPMS_H, F
+000030 2825 GOTO DMS_START
+000031 0008 RETURN
+
+
+ INITSYS
+000032 0185 CLRF PORTA
+000033 0186 CLRF PORTB
+000034 0008 RETURN
+
+
diff --git a/trunk/workspace/gcb/16c84-mouse.gcb b/trunk/workspace/gcb/16c84-mouse.gcb
new file mode 100644
index 00000000..2a963fbe
--- /dev/null
+++ b/trunk/workspace/gcb/16c84-mouse.gcb
@@ -0,0 +1,125 @@
+' ########### start ###########
+' pic:PIC16C84
+' ########### end ###########
+
+'----------------------------------------------------------------------
+' Mouse adapter for Atari ST and AMIGA
+' 2018-02-15 (c) Paolo Iocco
+'
+' Circuit diagram
+' ---------------
+' ATTiny84
+' +-----+
+' VCC-------->|° |<--------GND
+' PB0-------->| |<--------PA0
+' PB1-------->| |<--------PA1
+' PB3/Reset-->| |---------PA2
+' PB2---------| |---------PA3
+' PA7---------| |---------PA4 SCK
+' PA6 MOSI----| |---------PA5 MISO
+' +-----+
+'
+' schematic ATARI ST
+'
+' +°--\ /---+
+' Y_AXE------>|RA2 RA1|<--|10K|<-- NC
+' X_AXE------>|RA3 RA0|<--|10K|<-- NC
+' LB DB.6---->|RA4 O2|<----RC Oscillator
+' +5V--|50K|-->|RES O1|-
+' GND-------->|5 14|<--------+5V
+' RB DB.9---->|RB0 RB7|-
+' -|RB1 RB6|-
+' YB DB.4---->|RB2 RB5|-----DB.1 XB
+' YA DB.3---->|RB3 RB4|-----DB.2 XA
+' +---------+
+'----------------------------------------------------------------------
+'
+' DB9 STANDARDS
+' ~~~~~~~~~~~~~
+'
+' Atari ST AMIGA
+'
+' +---------> YB +---------> XB
+' | +-------> YA | +-------> YA
+' | | +-----> XA | | +-----> XA
+' | | | +---> XB | | | +---> YB
+' | | | | | | | |
+' _____________ _____________
+' 5 \ x o o o o / 1 5 \ x o o o o / 1
+' \ o o o o / \ o o o o /
+' 9 `~~~~~~~' 6 9 `~~~~~~~' 6
+' | | | | | | | |
+' | | | +----> Left Button | | | +----> Left Button
+' | | +------> Power | | +------> Power
+' | +--------> Ground | +--------> Ground
+' +----------> Right Button +----------> Right Button
+
+'Chip model
+'#chip tiny84a, 8
+#Chip 16C84, 4.19
+#Config OSC = HS, WDT = OFF, PWRTE = ON, CP = OFF
+
+#define X_AXE PORTA.3
+#define Y_AXE PORTA.2
+
+#define XB PORTB.5
+#define XA PORTB.4
+#define YA PORTB.3
+#define YB PORTB.2
+#define LB PORTA.4
+#define RB PORTB.0
+
+setup:
+
+loop:
+Do
+ Pot X_AXE, x_val
+ Pot Y_AXE, y_val
+ select case x_val
+ case <= 120
+ set XA on
+ wait 1 ms
+ set XB on
+ wait 1 ms
+ set XA off
+ wait 1 ms
+ set XB off
+ wait 1 ms
+ case >= 135
+ set XB on
+ wait 1 ms
+ set XA on
+ wait 1 ms
+ set XB off
+ wait 1 ms
+ set XA off
+ wait 1 ms
+ case else
+ set XA off
+ set XB off
+ end select
+
+ select case y_val
+ case <= 120
+ set YA on
+ wait 1 ms
+ set YB on
+ wait 1 ms
+ set YA off
+ wait 1 ms
+ set YB off
+ wait 1 ms
+ case >= 135
+ set YB on
+ wait 1 ms
+ set YA on
+ wait 1 ms
+ set YB off
+ wait 1 ms
+ set YA off
+ wait 1 ms
+ case else
+ set YA off
+ set YB off
+ end select
+Loop
diff --git a/trunk/workspace/gcb/16c84-pwm.gcb b/trunk/workspace/gcb/16c84-pwm.gcb
new file mode 100644
index 00000000..023fd2a0
--- /dev/null
+++ b/trunk/workspace/gcb/16c84-pwm.gcb
@@ -0,0 +1,69 @@
+' ########### start ###########
+' pic:PIC16C84
+' ########### end ###########
+
+'================================================
+'AUTOMATED CODE GENERATED 01-21-2014 10:08:31
+'================================================
+
+' Circuit diagram
+' ---------------
+' +--\/--+
+' nc-----|1° 18|-----nc
+' nc-----|2 17|--------->PWM_OUT
+' nc-----|3 16|<--------H
+' +5V--|50K|-->|4 15|<--------H = 4 MHz chrystal+ capacitors
+' GND-------->|5 14|<--------+5V
+' nc-----|6 13|-----nc
+' nc-----|7 12|-----nc
+' nc-----|8 11|-----nc
+' nc-----|9 10|-----nc
+' +------+
+'-------------------------------------------------------------
+
+'================================================
+'CHIP SETUP AND COFIGURATION BITS
+'================================================
+#Chip 16C84, 4
+#Config OSC = XT, WDT = OFF, PWRTE = ON, CP = OFF
+'Configuration bits to be set here for example:
+'#Config INTOSC_OSC_NOCLKOUT, MCLRE = OFF
+'#Config BOREN = OFF, CP = OFF, DATA = CP_OFF
+'#Config PWRTE = OFF, WDT = OFF, LVP = OFF
+'Read help and consult the data sheet
+
+'================================================
+'DEFINE CONSTANTS
+'================================================
+
+'================================================
+'DEFINE PORTIO
+'================================================
+#define PWM_Out1 PORTA.0
+
+
+'================================================
+'DECLARE VARIABLES
+'================================================
+'dir SoftPWM1 out
+
+
+'================================================
+'INIT INTERRUPTS
+'================================================
+
+'================================================
+'MAIN PRORAM LOOP
+'================================================
+Startup:
+
+'Main routine
+Loop:
+ PWMOut 1,128,100
+Goto Loop
+
+'================================================
+'SUB ROUTINES
+'================================================
+
+
diff --git a/trunk/workspace/gcb/16c84-serial.gcb b/trunk/workspace/gcb/16c84-serial.gcb
new file mode 100644
index 00000000..a779e1db
--- /dev/null
+++ b/trunk/workspace/gcb/16c84-serial.gcb
@@ -0,0 +1,55 @@
+' ########### start ###########
+' pic:PIC16C84
+' ########### end ###########
+'
+' ******************************************************************
+' Test for a Serial transmission with a PIC16C84
+' 2014-02-04 (c) Paolo Iocco
+' ******************************************************************
+'
+' Circuit diagram
+' ---------------
+' +--\/--+
+' nc-----|1° 18|--------> TX
+' nc-----|2 17|<-------- RX
+' nc-----|3 16|<--------H
+' +5V--|50K|-->|4 15|<--------H = 4 MHz chrystal+ capacitors
+' GND-------->|5 14|<--------+5V
+' nc-----|6 13|-----nc
+' nc-----|7 12|-----nc
+' nc-----|8 11|-----nc
+' nc-----|9 10|-----nc
+' +------+
+'
+' ******************************************************************
+
+Config:
+#Chip 16C84, 4
+#Config OSC = XT, WDT = OFF, PWRTE = ON, CP = OFF
+'Set the pin directions
+Dir PORTA.1 Out 'send on Pin 18
+Dir PORTA.0 In 'receive on Pin 17
+
+'Config Software-UART
+#define SendAHigh Set PORTA.1 ON
+#define SendALow Set PORTA.1 OFF
+#define RecAHigh PORTA.0 ON
+#define RecALow PORTA.0 OFF
+
+'-------------------------------------------------------------
+Startup:
+InitSer 1, r9600, 1+WaitForStart, 8, 1, None, Invert
+' Message after reset
+SerSend 1, 0x31 ' 1
+SerSend 1, 0x36 ' 6
+SerSend 1, 0x43 ' C
+SerSend 1, 0x38 ' 8
+SerSend 1, 0x34 ' 4
+SerSend 1, 0x0D ' "Carriage Return"
+SerSend 1, 0x0A ' "Line Feed"
+'-------------------------------------------------------------
+'Main routine
+Loop:
+ SerReceive 1, InChar 'wait for char from UART
+ SerSend 1, InChar 'send back char to UART
+Goto Loop
diff --git a/trunk/workspace/gcb/16c84-spaceinvaders.gcb b/trunk/workspace/gcb/16c84-spaceinvaders.gcb
new file mode 100644
index 00000000..9189213f
--- /dev/null
+++ b/trunk/workspace/gcb/16c84-spaceinvaders.gcb
@@ -0,0 +1,46 @@
+' ########### start ###########
+' pic:PIC16C84
+' ########### end ###########
+'
+' ******************************************************************
+' Test for a IRQ Routine with a PIC16C84
+' 2014-08-18 (c) Paolo Iocco
+' ******************************************************************
+'
+' Circuit diagram
+' ---------------
+' +--\/--+
+' nc-----|1° 18|-------->LED
+' nc-----|2 17|-----nc
+' nc-----|3 16|<--------H
+' +5V--|50K|-->|4 15|<--------H = 4 MHz chrystal+ capacitors
+' GND-------->|5 14|<--------+5V
+' nc-----|6 13|-----nc
+' nc-----|7 12|-----nc
+' nc-----|8 11|-----nc
+' nc-----|9 10|-----nc
+' +------+
+'
+' ******************************************************************
+
+#Chip 16C84, 4
+#Config OSC = XT, WDT = OFF, PWRTE = ON, CP = OFF
+
+dir PORTB out
+dim direzione as byte
+
+Startup:
+direzione = 1
+PORTB = 1
+
+Loop:
+do
+ if direzione=1 then
+ rotate PORTB left
+ if PORTB >= 64 then direzione = 0
+ else
+ rotate PORTB right
+ if PORTB <= 1 then direzione = 1
+ end if
+ wait 250 ms
+loop
diff --git a/trunk/workspace/gcb/16f1847-blink.gcb b/trunk/workspace/gcb/16f1847-blink.gcb
new file mode 100644
index 00000000..d52e07d1
--- /dev/null
+++ b/trunk/workspace/gcb/16f1847-blink.gcb
@@ -0,0 +1,44 @@
+' ########### start ###########
+' pic:PIC16F1847
+' ########### end ###########
+'
+' ******************************************************************
+' A program to flash LED on PORTA.2
+' 2014-08-18 (c) Paolo Iocco
+' ******************************************************************
+'
+' Circuit diagram
+' ---------------
+' +--\/--+
+' LED<-----|1° 18|-----nc
+' nc-----|2 17|-----nc
+' nc-----|3 16|-----nc
+' +5V--|50K|-->|4 15|-----nc
+' GND-------->|5 14|<--------+5V
+' nc-----|6 13|-----nc
+' nc-----|7 12|-----nc
+' nc-----|8 11|-----nc
+' nc-----|9 10|-----nc
+' +------+
+'
+' ******************************************************************
+
+'Chip model
+#chip 16f1847, 8
+#config OSC = INTOSCIO, WDTE = OFF, PWRTE = ON, CP = OFF
+#define led PORTA.2
+
+Startup:
+
+'Main routine
+Loop:
+ 'Turn one LED on, the other off
+ SET led ON
+ wait 1 sec
+ 'Now toggle the LEDs
+
+ SET led OFF
+ wait 1 sec
+'Jump back to the start of the program
+goto Loop
+
diff --git a/trunk/workspace/gcb/16f57-blink.gcb b/trunk/workspace/gcb/16f57-blink.gcb
new file mode 100644
index 00000000..00b7235d
--- /dev/null
+++ b/trunk/workspace/gcb/16f57-blink.gcb
@@ -0,0 +1,24 @@
+' ########### start ###########
+' pic:PIC16F57
+' ########### end ###########
+'A program to flash LED on PIN 13/PORTB5
+
+'Chip model
+#chip 16f57, 8
+#config OSC = XT, WDT = OFF, CP = OFF ' PWRTE = ON
+#define led PORTB.5
+
+Startup:
+
+'Main routine
+Loop:
+ 'Turn one LED on, the other off
+ SET led ON
+ wait 1 sec
+ 'Now toggle the LEDs
+
+ SET led OFF
+ wait 1 sec
+'Jump back to the start of the program
+goto Loop
+
diff --git a/trunk/workspace/gcb/16f628a-blink.gcb b/trunk/workspace/gcb/16f628a-blink.gcb
new file mode 100644
index 00000000..b024b894
--- /dev/null
+++ b/trunk/workspace/gcb/16f628a-blink.gcb
@@ -0,0 +1,44 @@
+' ########### start ###########
+' pic:PIC16F628A
+' ########### end ###########
+'
+' ******************************************************************
+' A program to flash LED on PORTB5
+' 2014-08-18 (c) Paolo Iocco
+' ******************************************************************
+'
+' Circuit diagram
+' ---------------
+' +--\/--+
+' nc-----|1° 18|-----nc
+' nc-----|2 17|-----nc
+' nc-----|3 16|<--------H
+' +5V--|50K|-->|4 15|<--------H = 4 MHz chrystal+ capacitors
+' GND-------->|5 14|<--------+5V
+' nc-----|6 13|-----nc
+' nc-----|7 12|-----nc
+' nc-----|8 11|-------->LED
+' nc-----|9 10|-----nc
+' +------+
+'
+' ******************************************************************
+
+'Chip model
+#chip 16f628a, 20
+#config OSC = XT, WDT = OFF, PWRTE = ON, CP = OFF
+#define led PORTB.5
+
+Startup:
+
+'Main routine
+Loop:
+ 'Turn one LED on, the other off
+ SET led ON
+ wait 1 sec
+ 'Now toggle the LEDs
+
+ SET led OFF
+ wait 1 sec
+'Jump back to the start of the program
+goto Loop
+
diff --git a/trunk/workspace/gcb/16f688-blink.gcb b/trunk/workspace/gcb/16f688-blink.gcb
new file mode 100644
index 00000000..024d9edd
--- /dev/null
+++ b/trunk/workspace/gcb/16f688-blink.gcb
@@ -0,0 +1,43 @@
+' ########### start ###########
+' pic:PIC16F688
+' ########### end ###########
+'
+' ******************************************************************
+' A program to flash LED on PORTA.2
+' 2014-08-18 (c) Paolo Iocco
+' ******************************************************************
+'
+' Circuit diagram
+' ---------------
+' +--\/--+
+' VCC-----|1° 14|<-----GND
+' nc-----|2 13|-----nc
+' nc-----|3 12|-----nc
+' nc-----|4 11|----->LED
+' nc-----|5 10|-----nc
+' nc-----|6 9|-----nc
+' nc-----|7 8|-----nc
+' +------+
+'
+' ******************************************************************
+
+'Chip model
+#chip 16f688, 8
+#config OSC = INTOSC
+#config WDTE = OFF, PWRTE = ON, CP = OFF
+#define led PORTA.2
+
+Startup:
+
+'Main routine
+Loop:
+ 'Turn one LED on, the other off
+ SET led ON
+ wait 1 sec
+ 'Now toggle the LEDs
+
+ SET led OFF
+ wait 1 sec
+'Jump back to the start of the program
+goto Loop
+
diff --git a/trunk/workspace/gcb/16f873a-TimerElisa.gcb b/trunk/workspace/gcb/16f873a-TimerElisa.gcb
new file mode 100644
index 00000000..913b711f
--- /dev/null
+++ b/trunk/workspace/gcb/16f873a-TimerElisa.gcb
@@ -0,0 +1,291 @@
+' ########### start ###########
+' pic:PIC16F873A
+' ########### end ###########
+'
+' ******************************************************************
+' Timer con Display 7 segmenti per Elisa
+' 2023-02-16 (c) Paolo Iocco
+' ******************************************************************
+'
+' Circuit diagram
+' ---------------
+' PIC28 Pinout
+' +--\/--+
+' /MCLR VPP 1|o |28 RB7 KBI3 PGD
+' AN0 RA0 2| |27 RB6 KBI2 PGC
+' AN1 RA1 3| |26 RB5 KBI1
+' Vref- AN2 RA2 4| |25 RB4 KBI0
+' Vref+ AN3 RA3 5| |24 RB3 PGM CAN-RX
+' T0CKi RA4 6| |23 RB2 /INT2 CAN-TX
+' SS AN4 RA5 7| |22 RB1 /INT1
+' AVss 8| |21 RB0 /INT0
+' OSC1 9| |20 Vdd
+' OSC2 10| |19 Vss
+' T1CKi RC0 11| |18 RC7 RX DT
+' CCP2 RC1 12| |17 RC6 TX CK
+' CCP1 RC2 13| |16 RC5 SKO D+
+' SCL SCK RC3 14| |15 RC4 SDI D- SDA
+' +------+
+'
+' ******************************************************************
+
+'Chip model
+#chip 16f873A, 16
+#config OSC = HS, WDT = OFF, PWRTE = ON, CP = OFF
+
+dim milliseconds as byte ' counter per i millisecondi
+dim Timer_1 as byte
+dim Timer_10 as byte
+dim Timer_100 as byte
+
+dim stato as byte ' Byte di stato del programma
+#define S_Running stato.0 ' bit 0: countdown running
+#define S_Led stato.7 ' bit 7: stato del led / PWM
+dim blink as byte
+#define B_Points blink.0
+#define B_Digit1 blink.1
+#define B_Digit2 blink.2
+#define B_Digit3 blink.3
+#define B_Digit4 blink.4
+
+#define acceso on ' common cathode + NPN --> high = ON
+#define spento off ' common cathode + NPN --> low = OFF
+#define DISP_SEL_1 PORTC.7 '
+#define DISP_SEL_2 PORTC.6 '
+#define DISP_SEL_3 PORTC.5 '
+#define DISP_SEL_4 PORTC.4 '
+#define DISP_SEL_S PORTC.3 '
+#define DISP_SEG_A PORTB.0 '
+#define DISP_SEG_B PORTB.1 '
+#define DISP_SEG_C PORTB.2 '
+#define DISP_SEG_D PORTB.3 '
+#define DISP_SEG_E PORTB.4 '
+#define DISP_SEG_F PORTB.5 '
+#define DISP_SEG_G PORTB.6 '
+#define DISP_SEG_P PORTB.7 '
+#define LED PORTA.2 ' led on Pin A2
+#define Button1 PORTC.0 ' pushbutton on PORTC.0
+#define Button2 PORTC.1 ' pushbutton on PORTC.1
+#define Button3 PORTC.2 ' pushbutton on PORTC.3
+
+#define Timer_Charge 226 ' 255-125 Costante da calibrare: IRQ ogni ms
+#define minuti 6 ' Minuti iniziali
+#define secondi 30 ' Secondi iniziali
+#define scroll 150 ' velocità dello scroll in ms
+
+Dir LED Out
+Dir Button1 In
+Dir Button2 In
+Dir Button3 In
+
+'----------------------------------------------------------------------
+Interrupts:
+On Interrupt Timer0Overflow Call Tmr0_ISR ' Interrupt su Timer Overflow
+On Interrupt ExtInt0 ignore ' Interrupt su PORTB.0 INT
+On Interrupt PORTBChange Ignore ' Interrupt su PORTB change
+
+'----------------------------------------------------------------------
+Startup:
+InitTimer0 Osc, PS0_32 ' Impostazioni prescaler
+TMR0=Timer_Charge ' impostazioni Timer
+
+milliseconds=0 ' counter per i millisecondi
+Counter_m = minuti ' Inizializzazione minuti
+Counter_s = secondi ' Inizializzazione secondi
+set S_Running off ' parto in STOP
+
+Welcome ' splashscreen iniziale
+
+'----------------------------------------------------------------------
+Loop:
+do
+ if S_Running=1 then ' se il countdown è attivo
+ ' *** gestione del tempo ***
+ if Timer_100 = 0 then ' Tempo esaurito? 1000ms
+ if Counter_s>0 then ' decremento i secondi
+ Counter_s --
+ else
+ if Counter_m > 0 then ' decremento i minuti
+ Counter_m --
+ Counter_s = 59
+ end if
+ end if
+ Timer_100=10 ' ricarica il timer e riparto
+ end if
+
+ ' *** Tempo esaurito ***
+ if (Counter_s=0) and (Counter_m=0) then
+ set S_Running off ' Stato --> stop
+ set LED off ' Uscita PWM --> off
+ end if
+ end if
+
+ ' *** Gestione pulsante ***
+ if button1 = 0 then ' Premuto?
+ wait until button1 = 1 ' rilascio
+ if S_Running = 0 then ' se coutdown è fermo --> inizia
+ set S_Running on
+ set LED on
+ Timer_100 = 2 ' carico il timer per il ventilatore
+ wait until Timer_100 = 0 ' aspetto che il motorino parta 200ms al max per vincere l'inerzia
+ Timer_100 = 10 ' carico il timer da un secondo
+ else
+ set S_Running off ' se countdown È attivo --> stop
+ set LED off
+ end if
+ end if
+
+ ' *** Display routine (ciclica continua) ***
+ Display7s 1, Counter_m / 10 ' visualizza decine di minuti
+ Display7s 2, Counter_m % 10 ' visualizza unità di minuti
+ Display7s 3, Counter_s / 10 ' visualizza decine di secondi
+ Display7s 4, Counter_s % 10 ' visualizza unità di secondi
+loop
+
+' *** Splashscreen iniziale ***
+sub Welcome 'scrolling della scritta "HELLO"
+ timer_1=scroll
+ do
+ Display7s 1, " "
+ Display7s 2, " "
+ Display7s 3, " "
+ Display7s 4, " "
+ loop until timer_1=0
+ timer_1=scroll
+ do
+ Display7s 1, " "
+ Display7s 2, " "
+ Display7s 3, " "
+ Display7s 4, "H"
+ loop until timer_1=0
+ timer_1=scroll
+ do
+ Display7s 1, " "
+ Display7s 2, " "
+ Display7s 3, "H"
+ Display7s 4, "E"
+ loop until timer_1=0
+ timer_1=scroll
+ do
+ Display7s 1, " "
+ Display7s 2, "H"
+ Display7s 3, "E"
+ Display7s 4, "L"
+ loop until timer_1=0
+ timer_1=scroll
+ do
+ Display7s 1, "H"
+ Display7s 2, "E"
+ Display7s 3, "L"
+ Display7s 4, "L"
+ loop until timer_1=0
+ timer_1=scroll
+ do
+ Display7s 1, "E"
+ Display7s 2, "L"
+ Display7s 3, "L"
+ Display7s 4, "O"
+ loop until timer_1=0
+ timer_1=scroll
+ do
+ Display7s 1, "L"
+ Display7s 2, "L"
+ Display7s 3, "O"
+ Display7s 4, " "
+ loop until timer_1=0
+ timer_1=scroll
+ do
+ Display7s 1, "L"
+ Display7s 2, "O"
+ Display7s 3, " "
+ Display7s 4, " "
+ loop until timer_1=0
+ timer_1=scroll
+ do
+ Display7s 1, "O"
+ Display7s 2, " "
+ Display7s 3, " "
+ Display7s 4, " "
+ loop until timer_1=0
+ timer_1=scroll
+ do
+ Display7s 1, " "
+ Display7s 2, " "
+ Display7s 3, " "
+ Display7s 4, " "
+ loop until timer_1=0
+end sub
+
+' *** Display Routines ***
+sub Display7s (posizione,numero)
+ set DISP_SEL_1 spento
+ set DISP_SEL_2 spento
+ set DISP_SEL_3 spento
+ set DISP_SEL_4 spento
+ wait 200 us
+
+ select case numero
+ case 0: segmenti = 0b'01111110'
+ case 1: segmenti = 0b'00110000'
+ case 2: segmenti = 0b'01101101'
+ case 3: segmenti = 0b'01111001'
+ case 4: segmenti = 0b'00110011'
+ case 5: segmenti = 0b'01011011'
+ case 6: segmenti = 0b'01011111'
+ case 7: segmenti = 0b'01110000'
+ case 8: segmenti = 0b'01111111'
+ case 9: segmenti = 0b'01111011'
+ case " ": segmenti = 0b'00000000'
+ case "A": segmenti = 0b'01110111'
+ case "B": segmenti = 0b'01111111'
+ case "C": segmenti = 0b'01001110'
+ case "D": segmenti = 0b'00111101'
+ case "E": segmenti = 0b'01001111'
+ case "F": segmenti = 0b'01000111'
+ case "G": segmenti = 0b'01011110'
+ case "H": segmenti = 0b'00110111'
+ case "I": segmenti = 0b'00011000'
+ case "L": segmenti = 0b'00001110'
+ case "O": segmenti = 0b'01111110'
+ case "P": segmenti = 0b'01100111'
+ case "R": segmenti = 0b'00000101'
+ case "S": segmenti = 0b'01011011'
+ case "U": segmenti = 0b'00111110'
+ case "Z": segmenti = 0b'01101101'
+ case else: segmenti = 0b'00000000'
+ end select
+
+ DISP_SEG_G = segmenti.0
+ DISP_SEG_F = segmenti.1
+ DISP_SEG_E = segmenti.2
+ DISP_SEG_D = segmenti.3
+ DISP_SEG_C = segmenti.4
+ DISP_SEG_B = segmenti.5
+ DISP_SEG_A = segmenti.6
+
+ select case posizione
+ case 1: set DISP_SEL_1 acceso
+ case 2: set DISP_SEL_2 acceso
+ case 3: set DISP_SEL_3 acceso
+ case 4: set DISP_SEL_4 acceso
+ end select
+
+ wait 1500 us
+end sub
+
+' *** Interrupt Routines ***
+Sub Tmr0_ISR ' *** on Timer0 Overflow (IRQ on transition 255 to 0) ***
+ T0IF=0 'reset Interrupt Flag
+ TMR0=Timer_Charge 'reload counter --> Timer_Charge
+
+ milliseconds = (milliseconds +1) % 100
+ if Timer_1>0 then
+ Timer_1 -- 'decrease Timer 1ms
+ end if
+ if ((milliseconds%10)=0) and (Timer_10>0) then
+ Timer_10 -- 'decreases Timer 10ms
+ end if
+ if (milliseconds=0) and (Timer_100>0) then
+ Timer_100 -- 'decreases Timer 100ms
+ end if
+End Sub
diff --git a/trunk/workspace/gcb/16f873a-blink.gcb b/trunk/workspace/gcb/16f873a-blink.gcb
new file mode 100644
index 00000000..2d5f0204
--- /dev/null
+++ b/trunk/workspace/gcb/16f873a-blink.gcb
@@ -0,0 +1,51 @@
+' ########### start ###########
+' pic:PIC16F873A
+' ########### end ###########
+'
+' ******************************************************************
+' A program to flash LED on PORTA.2
+' 2014-06-30 (c) Paolo Iocco
+' ******************************************************************
+'
+' Circuit diagram
+' ---------------
+' PIC28 Pinout
+' +--\/--+
+' /MCLR VPP 1|o |28 RB7 KBI3 PGD
+' AN0 RA0 2| |27 RB6 KBI2 PGC
+' AN1 RA1 3| |26 RB5 KBI1
+' Vref- AN2 RA2 4| |25 RB4 KBI0
+' Vref+ AN3 RA3 5| |24 RB3 PGM CAN-RX
+' T0CKi RA4 6| |23 RB2 /INT2 CAN-TX
+' SS AN4 RA5 7| |22 RB1 /INT1
+' AVss 8| |21 RB0 /INT0
+' OSC1 9| |20 Vdd
+' OSC2 10| |19 Vss
+' T1CKi RC0 11| |18 RC7 RX DT
+' CCP2 RC1 12| |17 RC6 TX CK
+' CCP1 RC2 13| |16 RC5 SKO D+
+' SCL SCK RC3 14| |15 RC4 SDI D- SDA
+' +------+
+'
+' ******************************************************************
+
+'Chip model
+#chip 16f873A, 16
+
+#config OSC = HS, WDT = OFF, PWRTE = ON, CP = OFF
+#define led PORTA.2
+
+Startup:
+count = ReadAD(AN0)
+'Main routine
+Loop:
+ 'Turn one LED on, the other off
+ SET led ON
+ wait 1 sec
+ 'Now toggle the LEDs
+
+ SET led OFF
+ wait 1 sec
+'Jump back to the start of the program
+goto Loop
+
diff --git a/trunk/workspace/gcb/16f874a-blink.gcb b/trunk/workspace/gcb/16f874a-blink.gcb
new file mode 100644
index 00000000..3af8ece0
--- /dev/null
+++ b/trunk/workspace/gcb/16f874a-blink.gcb
@@ -0,0 +1,37 @@
+' ########### start ###########
+' pic:PIC16F874A
+' ########### end ###########
+
+'A program to flash LED on PORTB0
+
+'Chip model
+#chip 16f874a, 25
+#config FOSC = HS, WDTE = OFF, CP = OFF, PWRTE = OFF, LVP = OFF, DEBUG = ON
+
+#define led PORTB.3
+
+#define LCD_IO 4
+#define LCD_NO_RW
+#define LCD_RS PORTD.2
+#define LCD_Enable PORTD.3
+#define LCD_DB4 PORTD.4
+#define LCD_DB5 PORTD.5
+#define LCD_DB6 PORTD.6
+#define LCD_DB7 PORTD.7
+
+Startup:
+Locate 0,0
+Print "* Love *"
+Locate 1,0
+Print "*Silvia*"
+
+ana = ReadAD(AN0)
+'Main routine
+Loop:
+ 'Turn one LED on, then off
+ SET led ON
+ Wait 500 ms
+ SET led OFF
+ Wait 500 ms
+goto Loop
+
diff --git a/trunk/workspace/gcb/16f876a-blink.gcb b/trunk/workspace/gcb/16f876a-blink.gcb
new file mode 100644
index 00000000..de3780d8
--- /dev/null
+++ b/trunk/workspace/gcb/16f876a-blink.gcb
@@ -0,0 +1,51 @@
+' ########### start ###########
+' pic:PIC16F876A
+' ########### end ###########
+'
+' ******************************************************************
+' A program to flash LED on PORTA.2
+' 2014-06-30 (c) Paolo Iocco
+' ******************************************************************
+'
+' Circuit diagram
+' ---------------
+' PIC28 Pinout
+' +--\/--+
+' /MCLR VPP 1|o |28 RB7 KBI3 PGD
+' AN0 RA0 2| |27 RB6 KBI2 PGC
+' AN1 RA1 3| |26 RB5 KBI1
+' Vref- AN2 RA2 4| |25 RB4 KBI0
+' Vref+ AN3 RA3 5| |24 RB3 PGM CAN-RX
+' T0CKi RA4 6| |23 RB2 /INT2 CAN-TX
+' SS AN4 RA5 7| |22 RB1 /INT1
+' AVss 8| |21 RB0 /INT0
+' OSC1 9| |20 Vdd
+' OSC2 10| |19 Vss
+' T1CKi RC0 11| |18 RC7 RX DT
+' CCP2 RC1 12| |17 RC6 TX CK
+' CCP1 RC2 13| |16 RC5 SKO D+
+' SCL SCK RC3 14| |15 RC4 SDI D- SDA
+' +------+
+'
+' ******************************************************************
+
+'Chip model
+#chip 16f876A, 16
+
+#config OSC = HS, WDT = OFF, PWRTE = ON, CP = OFF
+#define led PORTA.2
+
+Startup:
+count = ReadAD(AN0)
+'Main routine
+Loop:
+ 'Turn one LED on, the other off
+ SET led ON
+ wait 1 sec
+ 'Now toggle the LEDs
+
+ SET led OFF
+ wait 1 sec
+'Jump back to the start of the program
+goto Loop
+
diff --git a/trunk/workspace/gcb/16f883-blink.gcb b/trunk/workspace/gcb/16f883-blink.gcb
new file mode 100644
index 00000000..bad8722f
--- /dev/null
+++ b/trunk/workspace/gcb/16f883-blink.gcb
@@ -0,0 +1,51 @@
+' ########### start ###########
+' pic:PIC16F883
+' ########### end ###########
+'
+' ******************************************************************
+' A program to flash LED on PORTA.2
+' 2014-06-30 (c) Paolo Iocco
+' ******************************************************************
+'
+' Circuit diagram
+' ---------------
+' PIC28 Pinout
+' +--\/--+
+' /MCLR VPP 1|o |28 RB7 KBI3 PGD
+' AN0 RA0 2| |27 RB6 KBI2 PGC
+' AN1 RA1 3| |26 RB5 KBI1
+' Vref- AN2 RA2 4| |25 RB4 KBI0
+' Vref+ AN3 RA3 5| |24 RB3 PGM CAN-RX
+' T0CKi RA4 6| |23 RB2 /INT2 CAN-TX
+' SS AN4 RA5 7| |22 RB1 /INT1
+' AVss 8| |21 RB0 /INT0
+' RA7 OSC1 9| |20 Vdd
+' RA6 OSC2 10| |19 Vss
+' T1CKi RC0 11| |18 RC7 RX DT
+' CCP2 RC1 12| |17 RC6 TX CK
+' CCP1 RC2 13| |16 RC5 SKO D+
+' SCL SCK RC3 14| |15 RC4 SDI D- SDA
+' +------+
+'
+' ******************************************************************
+
+'Chip model
+#chip 16f883, 8
+
+#config OSC = INTOSCIO, WDT = OFF, PWRTE = ON', CP = OFF
+#define led PORTA.2
+
+Startup:
+count = ReadAD(AN0)
+'Main routine
+Loop:
+ 'Turn one LED on, the other off
+ SET led ON
+ wait 1 sec
+ 'Now toggle the LEDs
+
+ SET led OFF
+ wait 1 sec
+'Jump back to the start of the program
+goto Loop
+
diff --git a/trunk/workspace/gcb/16f884-blink.gcb b/trunk/workspace/gcb/16f884-blink.gcb
new file mode 100644
index 00000000..098a9a8a
--- /dev/null
+++ b/trunk/workspace/gcb/16f884-blink.gcb
@@ -0,0 +1,57 @@
+' ########### start ###########
+' pic:PIC16F884
+' ########### end ###########
+'
+' ******************************************************************
+' A program to flash LED on PORTA.2
+' 2014-06-30 (c) Paolo Iocco
+' ******************************************************************
+'
+' Circuit diagram
+' ---------------
+' PIC40 Pinout
+' +--\/--+
+' /MCLR VPP 1|o |40 RB7 KBI3 PGD
+' AN0 RA0 2| |39 RB6 KBI2 PGC
+' AN1 RA1 3| |38 RB5 KBI1
+' Vref- AN2 RA2 4| |37 RB4 KBI0
+' Vref+ AN3 RA3 5| |36 RB3 PGM CAN-RX
+' T0CKi RA4 6| |35 RB2 /INT2 CAN-TX
+' SS AN4 RA5 7| |34 RB1 /INT1
+' RD AN5 RE0 8| |33 RB0 /INT0
+' WR AN6 RE1 9| |32 Vdd
+' CS AN7 RE3 10| |31 Vss
+' AVdd 11| |30 RD7 PSP7
+' AVss 12| |29 RD6 PSP6
+' OSC1 13| |28 RD5 PSP5
+' RA6 OSC2 14| |27 RD4 PSP4
+' T1CKi RC0 15| |26 RC7 RX DT
+' CCP2 RC1 16| |25 RC6 TX CK
+' CCP1 RC2 17| |24 RC5 SKO D+
+' SCL SCK RC3 18| |23 RC4 SDI D- SDA
+' PSP0 RD0 19| |22 RD3 PSP3
+' PSP1 RD1 20| |21 RD2 PSP2
+' +------+
+'
+' ******************************************************************
+
+'Chip model
+#chip 16f884, 8
+
+#config OSC = INTOSCIO, WDT = OFF, PWRTE = ON', CP = OFF
+#define led PORTA.2
+
+Startup:
+count = ReadAD(AN0)
+'Main routine
+Loop:
+ 'Turn one LED on, the other off
+ SET led ON
+ wait 1 sec
+ 'Now toggle the LEDs
+
+ SET led OFF
+ wait 1 sec
+'Jump back to the start of the program
+goto Loop
+
diff --git a/trunk/workspace/gcb/16f886-blink.gcb b/trunk/workspace/gcb/16f886-blink.gcb
new file mode 100644
index 00000000..691e4731
--- /dev/null
+++ b/trunk/workspace/gcb/16f886-blink.gcb
@@ -0,0 +1,51 @@
+' ########### start ###########
+' pic:PIC16F886
+' ########### end ###########
+'
+' ******************************************************************
+' A program to flash LED on PORTA.2
+' 2014-06-30 (c) Paolo Iocco
+' ******************************************************************
+'
+' Circuit diagram
+' ---------------
+' PIC28 Pinout
+' +--\/--+
+' /MCLR VPP 1|o |28 RB7 KBI3 PGD
+' AN0 RA0 2| |27 RB6 KBI2 PGC
+' AN1 RA1 3| |26 RB5 KBI1
+' Vref- AN2 RA2 4| |25 RB4 KBI0
+' Vref+ AN3 RA3 5| |24 RB3 PGM CAN-RX
+' T0CKi RA4 6| |23 RB2 /INT2 CAN-TX
+' SS AN4 RA5 7| |22 RB1 /INT1
+' AVss 8| |21 RB0 /INT0
+' RA7 OSC1 9| |20 Vdd
+' RA6 OSC2 10| |19 Vss
+' T1CKi RC0 11| |18 RC7 RX DT
+' CCP2 RC1 12| |17 RC6 TX CK
+' CCP1 RC2 13| |16 RC5 SKO D+
+' SCL SCK RC3 14| |15 RC4 SDI D- SDA
+' +------+
+'
+' ******************************************************************
+
+'Chip model
+#chip 16f886, 8
+
+#config OSC = INTOSCIO, WDT = OFF, PWRTE = ON', CP = OFF
+#define led PORTA.2
+
+Startup:
+count = ReadAD(AN0)
+'Main routine
+Loop:
+ 'Turn one LED on, the other off
+ SET led ON
+ wait 1 sec
+ 'Now toggle the LEDs
+
+ SET led OFF
+ wait 1 sec
+'Jump back to the start of the program
+goto Loop
+
diff --git a/trunk/workspace/gcb/16f887-blink.gcb b/trunk/workspace/gcb/16f887-blink.gcb
new file mode 100644
index 00000000..39e414b5
--- /dev/null
+++ b/trunk/workspace/gcb/16f887-blink.gcb
@@ -0,0 +1,57 @@
+' ########### start ###########
+' pic:PIC16F887
+' ########### end ###########
+'
+' ******************************************************************
+' A program to flash LED on PORTA.2
+' 2014-06-30 (c) Paolo Iocco
+' ******************************************************************
+'
+' Circuit diagram
+' ---------------
+' PIC40 Pinout
+' +--\/--+
+' /MCLR VPP 1|o |40 RB7 KBI3 PGD
+' AN0 RA0 2| |39 RB6 KBI2 PGC
+' AN1 RA1 3| |38 RB5 KBI1
+' Vref- AN2 RA2 4| |37 RB4 KBI0
+' Vref+ AN3 RA3 5| |36 RB3 PGM CAN-RX
+' T0CKi RA4 6| |35 RB2 /INT2 CAN-TX
+' SS AN4 RA5 7| |34 RB1 /INT1
+' RD AN5 RE0 8| |33 RB0 /INT0
+' WR AN6 RE1 9| |32 Vdd
+' CS AN7 RE3 10| |31 Vss
+' AVdd 11| |30 RD7 PSP7
+' AVss 12| |29 RD6 PSP6
+' OSC1 13| |28 RD5 PSP5
+' RA6 OSC2 14| |27 RD4 PSP4
+' T1CKi RC0 15| |26 RC7 RX DT
+' CCP2 RC1 16| |25 RC6 TX CK
+' CCP1 RC2 17| |24 RC5 SKO D+
+' SCL SCK RC3 18| |23 RC4 SDI D- SDA
+' PSP0 RD0 19| |22 RD3 PSP3
+' PSP1 RD1 20| |21 RD2 PSP2
+' +------+
+'
+' ******************************************************************
+
+'Chip model
+#chip 16f887, 8
+
+#config OSC = INTOSCIO, WDT = OFF, PWRTE = ON', CP = OFF
+#define led PORTA.2
+
+Startup:
+count = ReadAD(AN0)
+'Main routine
+Loop:
+ 'Turn one LED on, the other off
+ SET led ON
+ wait 1 sec
+ 'Now toggle the LEDs
+
+ SET led OFF
+ wait 1 sec
+'Jump back to the start of the program
+goto Loop
+
diff --git a/trunk/workspace/gcb/18f442-blink.gcb b/trunk/workspace/gcb/18f442-blink.gcb
new file mode 100644
index 00000000..f4c4f7ea
--- /dev/null
+++ b/trunk/workspace/gcb/18f442-blink.gcb
@@ -0,0 +1,25 @@
+' ########### start ###########
+' pic:PIC18F422
+' ########### end ###########
+
+'A program to flash LED on PORTB.3
+
+'Chip model
+#chip 18f442, 25
+#config OSC = HS, WDT = OFF, PWRTE = ON', CP = OFF
+#define led PORTB.3
+
+Startup:
+count = ReadAD(AN0)
+'Main routine
+Loop:
+ 'Turn one LED on, the other off
+ SET led ON
+ wait 1 sec
+ 'Now toggle the LEDs
+
+ SET led OFF
+ wait 1 sec
+'Jump back to the start of the program
+goto Loop
+
diff --git a/trunk/workspace/gcb/18f4550-blink.gcb b/trunk/workspace/gcb/18f4550-blink.gcb
new file mode 100644
index 00000000..92cc833e
--- /dev/null
+++ b/trunk/workspace/gcb/18f4550-blink.gcb
@@ -0,0 +1,25 @@
+' ########### start ###########
+' pic:PIC18F4550
+' ########### end ###########
+
+'A program to flash LED on PORTB.3
+
+'Chip model
+#chip 18f4550, 32
+#config OSC = HS, WDT = OFF, PWRTE = ON', CP = OFF
+#define led PORTB.3
+
+Startup:
+count = ReadAD(AN0)
+'Main routine
+Loop:
+ 'Turn one LED on, the other off
+ SET led ON
+ wait 1 sec
+ 'Now toggle the LEDs
+
+ SET led OFF
+ wait 1 sec
+'Jump back to the start of the program
+goto Loop
+
diff --git a/trunk/workspace/gcb/18f4580-blink.gcb b/trunk/workspace/gcb/18f4580-blink.gcb
new file mode 100644
index 00000000..aea601ad
--- /dev/null
+++ b/trunk/workspace/gcb/18f4580-blink.gcb
@@ -0,0 +1,25 @@
+' ########### start ###########
+' pic:PIC18F4580
+' ########### end ###########
+
+'A program to flash LED on PORTB.3
+
+'Chip model
+#chip 18f4580, 32
+#config OSC = HS, WDT = OFF, PWRTE = ON', CP = OFF
+#define led PORTB.3
+
+Startup:
+count = ReadAD(AN0)
+'Main routine
+Loop:
+ 'Turn one LED on, the other off
+ SET led ON
+ wait 1 sec
+ 'Now toggle the LEDs
+
+ SET led OFF
+ wait 1 sec
+'Jump back to the start of the program
+goto Loop
+
diff --git a/trunk/workspace/gcb/Example_SoftUART_12f1501.gcb b/trunk/workspace/gcb/Example_SoftUART_12f1501.gcb
new file mode 100644
index 00000000..ff454534
--- /dev/null
+++ b/trunk/workspace/gcb/Example_SoftUART_12f1501.gcb
@@ -0,0 +1,54 @@
+' ########### start ###########
+' pic:PIC12F1501
+' ########### end ###########
+
+; FILE: Example_SoftUART_12f1501.gcb
+; DATE: 31.01.2015
+; VERSION: 1.0a
+; AUTHOR: Evan R. Venn based on works of others
+;
+; Description.
+' A demonstration program for GCGB and GCB.
+' Receive a char from Software-UART and send it back.
+
+
+; This file is part of the Great Cow Basic compiler.
+;
+; This demonstration code is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+; GNU General Public License for more details.
+;
+; ----- Configuration
+
+ #chip 12f1501, 4
+ 'Set internal oscillator to 4 MHz
+ ' (writing to IRCF only does not work !?)
+ ' Set OSCCON = b'1101011' 'writing bit 0-6; bit 3-6 = IRCF
+
+; ----- Define Hardware settings
+ Dir PORTA.2 Out 'send on Pin 5
+ Dir PORTA.0 In 'receive on Pin 7 (PCD
+
+
+ 'Config Software-UART
+ #define SendAHigh Set PORTA.2 ON
+ #define SendALow Set PORTA.2 OFF
+ #define RecAHigh PORTA.0 ON
+ #define RecALow PORTA.0 OFF
+ InitSer 1, r2400, 1+WaitForStart, 8, 1, None, Invert
+
+; ----- Variables
+ ' No Variables specified in this example. All byte variables are defined upon use.
+
+; ----- Main body of program commences here.
+ 'Message after reset
+ SerPrint 1, " PIC 12f1501"
+ SerSend 1, 13 ' "Carriage Return"
+ SerSend 1, 10 ' "Line Feed"
+
+ 'Main routine
+ Start:
+ SerReceive 1, InChar 'wait for char from UART
+ SerSend 1, InChar 'send back char to UART
+ Goto Start
diff --git a/trunk/workspace/gcb/HardUART_18f4550.gcb b/trunk/workspace/gcb/HardUART_18f4550.gcb
new file mode 100644
index 00000000..31e17616
--- /dev/null
+++ b/trunk/workspace/gcb/HardUART_18f4550.gcb
@@ -0,0 +1,56 @@
+' ########### start ###########
+' pic:PIC18F4550
+' ########### end ###########
+
+; FILE: HardUART_18f4550.gcb
+; DATE: 31.01.2015
+; VERSION: 1.0a
+; AUTHOR: Evan R. Venn based on works of others
+;
+; Description.
+' A demonstration program for GCGB and GCB.
+' Receive a char from Hardware-UART and send it back.
+
+
+; This file is part of the Great Cow Basic compiler.
+;
+; This demonstration code is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+; GNU General Public License for more details.
+;
+; ----- Configuration
+
+ #chip 18F4550, 1
+
+
+; ----- Define Hardware settings
+ Dir PORTC.6 Out 'Tx = Pin 25
+ Dir PORTC.7 In 'Rx = Pin 26
+
+
+ 'Config hardware UART
+ #define USART_BLOCKING
+ #define USART_BAUD_RATE 4800
+
+ 'Invert UART data polarity to connect without max232:
+ Set TXCKP On 'inverted transmit data polarity
+ Set RXDTP On 'inverted receive data polarity
+ Wait 100 Ms
+
+
+; ----- Variables
+ ' No Variables specified in this example. All byte variables are defined upon use.
+
+; ----- Main body of program commences here.
+ HSerPrint "18F4550"
+ HSerPrintCRLF
+
+ 'Main routine
+ Start:
+ 'wait for char from UART
+ HSerReceive InChar
+ 'send back char to UART
+ HSerSend InChar
+ Goto Start
+ end
diff --git a/trunk/workspace/gcb/Hardware Serial Serial Buffer - 16F886.gcb b/trunk/workspace/gcb/Hardware Serial Serial Buffer - 16F886.gcb
new file mode 100644
index 00000000..ca67a779
--- /dev/null
+++ b/trunk/workspace/gcb/Hardware Serial Serial Buffer - 16F886.gcb
@@ -0,0 +1,101 @@
+' ########### start ###########
+' pic:PIC16F886
+' ########### end ###########
+
+; FILE: Hardware Serial Serial Buffer - 16F886.gcb
+; DATE: 31.01.2015
+; VERSION: 1.0a
+; AUTHOR: Evan R. Venn
+;
+; Description.
+' This example code implements a serial buffer ring.
+' This means the incoming serial port data is placed into a buffer that can be read at anytime.
+' This example uses an interrupt and a buffer.
+
+;
+;
+
+; This file is part of the Great Cow Basic compiler.
+;
+; This demonstration code is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+; GNU General Public License for more details.
+;
+; ----- Configuration
+
+ #chip 16F886, 16
+
+; ----- Define Hardware settings
+ ' Pot port
+ DIR PORTA.0 IN
+
+; ----- Constants
+ ' Define the USART port
+ #define USART_BAUD_RATE 9600
+ #define USART_BLOCKING true
+ ' [[change to your config] Ensure these port addresses are correct
+ #define SerInPort PORTc.7
+ #define SerOutPort PORTc.6
+ 'Set pin directions
+ Dir SerOutPort Out
+ Dir SerInPort In
+
+; Constants etc required for Buffer Ring
+ #define BUFFER_SIZE 8
+ #define bkbhit (next_in <> next_out)
+; Variables for Buffer Ring
+ Dim buffer(BUFFER_SIZE)
+ Dim next_in as byte: next_in = 1
+ Dim next_out as byte: next_out = 1
+
+
+; ----- Main body of program commences here.
+ 'Interrupt Handlers
+ On Interrupt UsartRX1Ready Call readUSART
+
+ HSerPrint "Buffer Ring"
+ HSerPrintCRLF 2
+
+
+
+
+
+
+
+
+
+ Do
+
+ ' wait for incoming data
+ do while bkbhit
+
+ ' send back the last data byte received!!
+ HSerSend chr(bgetc)
+
+ Loop
+
+ Loop
+
+; ----- Support methods. Subroutines and Functions
+
+ Sub readUSART
+
+ buffer(next_in) = HSerReceive
+ temppnt = next_in
+ next_in = ( next_in + 1 ) % BUFFER_SIZE
+ if ( next_in = next_out ) then ' buffer is full!!
+ next_in = temppnt
+ end if
+
+
+ End Sub
+
+
+ function bgetc
+ wait while !(bkbhit)
+ bgetc = buffer(next_out)
+ next_out=(next_out+1) % BUFFER_SIZE
+ end Function
+
+
diff --git a/trunk/workspace/gcb/Interrupt Counter to Hardware Serial Terminal - 16F886.gcb b/trunk/workspace/gcb/Interrupt Counter to Hardware Serial Terminal - 16F886.gcb
new file mode 100644
index 00000000..ba93b959
--- /dev/null
+++ b/trunk/workspace/gcb/Interrupt Counter to Hardware Serial Terminal - 16F886.gcb
@@ -0,0 +1,185 @@
+' ########### start ###########
+' pic:PIC16F886
+' ########### end ###########
+
+; FILE: Interrupt Counter to Hardware Serial Terminal - 16F886.gcb
+; DATE: 31.01.2015
+; VERSION: 1.0a
+; AUTHOR: Evan R. Venn
+;
+; Description.
+' A demonstration program for GCGB and GCB.
+' This program demonsates Interrupt upon the button press on portb.0
+' Each microprocessor will have different commands to setup the Interrupt. Refer to datasheet.
+' When each event occurs a counter is incremented.
+' Afer each event the counter is shown on the terminal.
+' The demonstration also show the four states a button can be in UP, PRESSED, DOWN and RELEASED.
+' Enjoy
+
+
+
+; This file is part of the Great Cow Basic compiler.
+;
+; This demonstration code is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+; GNU General Public License for more details.
+;
+ #chip 16F886,16
+
+; ----- Define Hardware settings
+ 'Config hardware UART
+ #define USART_BLOCKING
+ #define USART_BAUD_RATE 4800
+
+ 'Required for switch_event method
+ Dir portb.1 out
+ Dir SwitchIn1 In
+
+; ----- Constants
+ 'Required for switch_event method
+ #Define BUTTON_UP 0
+ #Define BUTTON_PRESSED 1
+ #Define BUTTON_DOWN 2
+ #Define BUTTON_RELEASED 3
+ #Define BUTTON_UNKNOWN 4
+
+
+ 'Required for switch_event method
+ #define SwitchIn1 PORTB.0
+ #define check_switch PORTB.0
+ #define state_switch ON
+
+
+; ----- Variables
+ Dim ButtonPressCount as Word
+ ButtonPressCount = 0
+
+ 'Required for switch_event method
+ Dim btn_pv
+
+
+
+; ----- Main body of program commences here.
+
+ 'INTEDG: Interrupt Edge Select bit
+ '1 = Interrupt on rising edge of INT pin
+ '0 = Interrupt on falling edge of INT pin
+ INTEDG = 0
+
+ 'Enable portb.0 as the source of the interrupt. See the datasheet for more information.
+ IOCB0 = 1
+ On Interrupt PORTBChange Call ButtonPressed
+
+ 'track button presses - required to manage serial display only
+ old_state = 0
+
+ do forever
+ 'determine the state of the switch
+ current_state = switch_event
+
+ 'if the current state is not the same as the saved state then print current state
+ if current_state <> old_state then
+ HSerPrint current_state
+ 'save state
+ old_state = current_state
+ end if
+ 'if the current state is Released then show the count.
+ 'count is incremented in the Interrupt routine.
+ if current_state = BUTTON_RELEASED then
+ HSerPrint "("+str( ButtonPressCount )
+ HSerPrint ")"
+ end if
+ 'print only if the button is Pressed. Formatting display only.
+ if current_state = BUTTON_PRESSED then
+ HSerPrint ":"
+ end if
+ loop
+ end
+
+; ----- Support methods. Subroutines and Functions
+ sub ButtonPressed
+ ButtonPressCount++
+ end sub
+
+
+
+
+'/****************************************************************************
+' Function:
+' input_event(void)
+'
+' Summary:
+' Processes the single button into the states UP, DOWN, PRESSED & RELEASED.
+'
+' Description:
+' This function helps write user interface state machines by determining when
+' the button was pressed, released
+'
+' Precondition:
+' None
+'
+' Parameters:
+' None
+'
+' Returns:
+' event_t value of the current button events.
+' Valid responses are BUTTON_UP, BUTTON_DOWN, BUTTON_PRESSED, BUTTON_RELEASED
+'
+' Remarks:
+' state_switch inverts the port. If high then use state_switch=off
+
+' #define SwitchIn1 PORTD.2
+' Dir SwitchIn1 In
+' #define check_switch RD2
+' #define state_switch OFF
+'
+' ***************************************************************************/
+
+ function switch_event()
+ dim ret As byte
+ Dim btn as Byte
+
+ btn = check_switch = state_switch
+
+ if !btn & !btn_pv then
+ ' button is not pressed now nor was it pressed previously
+ ret = BUTTON_UP
+
+ END if
+ if btn & !btn_pv then
+ ' button is pressed now but it wasn't previously
+ ret = BUTTON_PRESSED
+
+ End if
+ if btn & btn_pv then
+ ' button was pressed previously and is still pressed
+ ret = BUTTON_DOWN
+
+ end if
+ if !btn & btn_pv then
+ ' button is not pressed now but it was previously
+ ret = BUTTON_RELEASED
+ End If
+
+ btn_pv = btn
+ switch_event = ret
+ End Function
+
+ ' Debounce button, Debounce switch
+ Function input_switch ( )
+
+ dim ButtonCount as byte
+ input_switch = false
+ If check_switch = state_switch Then
+ ButtonCount = 0
+ Do While check_switch = state_switch and ButtonCount < 4
+ wait 5 ms
+ ButtonCount += 1
+ Loop
+ end if
+ If ButtonCount > 3 then
+ input_switch = true
+ ButtonCount = 0
+ end if
+ End Function
\ No newline at end of file
diff --git a/trunk/workspace/gcb/Interrupt driving LED via PWM - 16F886.gcb b/trunk/workspace/gcb/Interrupt driving LED via PWM - 16F886.gcb
new file mode 100644
index 00000000..9cbc57fa
--- /dev/null
+++ b/trunk/workspace/gcb/Interrupt driving LED via PWM - 16F886.gcb
@@ -0,0 +1,81 @@
+' ########### start ###########
+' pic:PIC16F886
+' ########### end ###########
+
+; FILE: Interrupt driving LED via PWM - 16F886.gcb
+; DATE: 31.01.2015
+; VERSION: 1.0a
+; AUTHOR: Evan R. Venn based on works of others
+;
+; Description.
+' A demonstration program for GCGB and GCB.
+' This adjusts the power to the LED over 2.5 seconds, then two zero power again over 2.5 seconds.
+' The LED is connected to Portb.0 via appropiate resistors.
+' The LED will reflect the value of AN0 in terms of brightness
+
+
+
+; This file is part of the Great Cow Basic compiler.
+;
+; This demonstration code is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+; GNU General Public License for more details.
+;
+ #chip 16F886,16
+
+; ----- Define Hardware settings
+ Dir Portb.0 out
+
+
+; ----- Constants
+ #define LED Portb.0
+
+
+; ----- Main body of program commences here.
+ 'Call the initialisation routine
+ InitLEDConrol
+
+ Do
+ 'Increase power to full over 2.5 seconds
+ For LEDPower = 0 to 100
+ LEDlum = LEDPower
+ Wait 25 ms
+ Next
+ 'Hold LEDPower
+ Wait 1 s
+ 'Decrease power to zero over 2.5 seconds
+ For LEDPower = 100 to 0
+ LEDlum = LEDPower
+ Wait 25 ms
+ Next
+ 'Hold LEDPower
+ Wait 1 s
+ Loop
+
+; ----- Support methods. Subroutines and Functions
+ 'Setup routine
+ Sub InitLEDConrol
+ 'Clear variables
+ LEDlum = 0
+ PWMCounter = 0
+
+ 'Add a handler for the interrupt
+ On Interrupt Timer0Overflow Call PWMHandler
+
+ 'Set up the timer
+ InitTimer0 Osc, PS0_2
+ 'Timer 0 starts automatically on a PIC
+ End Sub
+
+
+ 'This will be called when Timer 0 overflows
+ Sub PWMHandler
+ If LEDlum > PWMCounter Then
+ Set LED On
+ Else
+ Set LED Off
+ End If
+ PWMCounter += 1
+ If PWMCounter = 100 Then PWMCounter = 0
+ End Sub
diff --git a/trunk/workspace/gcb/LED Colour control 16F886.gcb b/trunk/workspace/gcb/LED Colour control 16F886.gcb
new file mode 100644
index 00000000..e4aa9191
--- /dev/null
+++ b/trunk/workspace/gcb/LED Colour control 16F886.gcb
@@ -0,0 +1,104 @@
+' ########### start ###########
+' pic:PIC16F886
+' ########### end ###########
+
+; FILE: LED Colour control 16F886.gcb
+; DATE: 31.01.2015
+; VERSION: 1.0a
+; AUTHOR: Evan R. Venn based on works of Hugh Considine
+;
+; Description.
+' A demostration program for GCGB and GCB.
+' Program controls the color of Tri-colour LED by the value of ANO
+' The attached LCD is used to show introduction text only.
+
+
+; This file is part of the Great Cow Basic compiler.
+;
+; This demonstration code is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+; GNU General Public License for more details.
+;
+; ----- Configuration
+
+ #chip 16F886,16
+
+
+; ----- Define Hardware settings
+ 'LED port directions
+ dir Red out
+ dir green out
+ dir blue out
+
+; ----- Constants
+ ; LCD setup
+ #define LCD_IO 8
+ #define LCD_DATA_PORT PORTC
+ #define LCD_RS PORTD.0
+ #define LCD_RW PORTD.1
+ #define LCD_Enable PORTD.2
+
+ 'LED pins
+ #define Red PORTB.2
+ #define Green PORTB.1
+ #define Blue PORTB.0
+
+; ----- Variables
+ 'Calculation Variable
+ Dim CalcTemp As Word
+
+
+; ----- Main body of program commences here.
+ 'Intro message
+ ; LCD Layout
+ ' 1234567890123456
+ PRINT "Tri-colour LED:"
+ locate 1,1
+ PRINT "A GCBASIC Demo"
+ Wait 2 sec
+
+ Main:
+ Hue = ReadAD(AN0)
+ If Hue < 20 Then Hue = 20
+ If Hue > 240 Then Hue = 240
+ Hue = Hue - 20
+ RInt = 0
+ GInt = 0
+ BInt = 0
+ If Hue < 220 And Hue > 150 Then
+ CalcTemp = ((220 - Hue) * 171) / 100
+ BInt = CalcTemp
+ CalcTemp = ((Hue - 150) * 286) / 100
+ RInt = CalcTemp
+ End If
+ If Hue < 150 And Hue > 120 Then
+ GInt = (150 - Hue) * 4
+ BInt = (Hue - 120) * 4
+ End If
+ If Hue < 120 Then
+ CalcTemp = ((120 - Hue) * 167)/100
+ RInt = CalcTemp
+ GInt = Hue
+ End If
+ ShowColour(RInt,GInt,BInt)
+ goto Main
+
+ end
+
+; ----- Support methods. Subroutines and Functions
+
+ sub ShowColour(RL, GL, BL)
+ RLTemp = RL+RL
+ FlashRate = ReadAD(AN0)
+ for PulseLoop = 1 to FlashRate
+ set red on
+ set green on
+ set blue on
+ for Level = 1 to 200
+ if Level > RLTemp then set red off
+ if Level > GL then set green off
+ if Level > BL then set blue off
+ next
+ next
+ end sub
\ No newline at end of file
diff --git a/trunk/workspace/gcb/LED Colour control mega328p.gcb b/trunk/workspace/gcb/LED Colour control mega328p.gcb
new file mode 100644
index 00000000..b69c0699
--- /dev/null
+++ b/trunk/workspace/gcb/LED Colour control mega328p.gcb
@@ -0,0 +1,112 @@
+' ########### start ###########
+' avr:mega328p
+' ########### end ###########
+
+; FILE: LED Colour control mega328p.gcb
+; DATE: 31.01.2015
+; VERSION: 1.0a
+; AUTHOR: Evan R. Venn based on works of Hugh Considine
+;
+; Description.
+' A demostration program for GCGB and GCB.
+' Program controls the color of Tri-colour LED by the value of ADCO
+' The attached LCD is used to show introduction text only.
+
+
+; This file is part of the Great Cow Basic compiler.
+;
+; This demonstration code is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+; GNU General Public License for more details.
+;
+; ----- Configuration
+
+ #chip mega328p,16
+
+
+; ----- Define Hardware settings
+ 'LED port directions
+ dir Red out
+ dir green out
+ dir blue out
+
+ ;Setup LCD Parameters
+ #define LCD_IO 4
+ #define LCD_NO_RW
+ #define LCD_Speed SLOW
+
+ 'Change as necessary
+ #define LCD_RS PortB.0
+ #define LCD_Enable PortB.1
+ #define LCD_DB4 PortC.3
+ #define LCD_DB5 PortC.2
+ #define LCD_DB6 PortC.1
+ #define LCD_DB7 PortC.0
+
+; ----- Constants
+
+ #define Red PORTB.2
+ #define Green PORTB.3
+ #define Blue PORTB.4
+
+; ----- Variables
+ 'Calculation Variable
+ Dim CalcTemp As Word
+
+
+; ----- Main body of program commences here.
+ 'Intro message
+ ; LCD Layout
+ ' 1234567890123456
+ PRINT "Tri-colour LED"
+ locate 1,0
+ PRINT "A GCBASIC Demo"
+ Wait 2 sec
+
+ Main:
+ ' You can use 0 [zero], or ADC0 or ANO they are mapped to the correct analog port.
+ Hue = ReadAD( 0 )
+ If Hue < 20 Then Hue = 20
+ If Hue > 240 Then Hue = 240
+ Hue = Hue - 20
+ RInt = 0
+ GInt = 0
+ BInt = 0
+ If Hue < 220 And Hue > 150 Then
+ CalcTemp = ((220 - Hue) * 171) / 100
+ BInt = CalcTemp
+ CalcTemp = ((Hue - 150) * 286) / 100
+ RInt = CalcTemp
+ End If
+ If Hue < 150 And Hue > 120 Then
+ GInt = (150 - Hue) * 4
+ BInt = (Hue - 120) * 4
+ End If
+ If Hue < 120 Then
+ CalcTemp = ((120 - Hue) * 167)/100
+ RInt = CalcTemp
+ GInt = Hue
+ End If
+ ShowColour(RInt,GInt,BInt)
+ goto Main
+
+ end
+
+; ----- Support methods. Subroutines and Functions
+
+ sub ShowColour(RL, GL, BL)
+ RLTemp = RL+RL
+ ' You can use 0 [zero], or ADC0 or ANO they are mapped to the correct analog port.
+ FlashRate = ReadAD( 0 )
+ for PulseLoop = 1 to FlashRate
+ set red on
+ set green on
+ set blue on
+ for Level = 1 to 200
+ if Level > RLTemp then set red off
+ if Level > GL then set green off
+ if Level > BL then set blue off
+ next
+ next
+ end sub
\ No newline at end of file
diff --git a/trunk/workspace/gcb/LED Tri-Colour change 16F886.gcb b/trunk/workspace/gcb/LED Tri-Colour change 16F886.gcb
new file mode 100644
index 00000000..fc42affb
--- /dev/null
+++ b/trunk/workspace/gcb/LED Tri-Colour change 16F886.gcb
@@ -0,0 +1,103 @@
+' ########### start ###########
+' pic:PIC16F886
+' ########### end ###########
+
+; FILE: LED Tri-Colour change 16F886.gcb
+; DATE: 31.01.2015
+; VERSION: 1.0a
+; AUTHOR: Evan R. Venn based on works of Hugh Considine
+;
+; Description.
+' A demostration program for GCGB and GCB.
+' Program drives Tri-colour LED.
+' The attached LCD is used to show introduction text only.
+
+
+; This file is part of the Great Cow Basic compiler.
+;
+; This demonstration code is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+; GNU General Public License for more details.
+;
+; ----- Configuration
+
+ #chip 16F886,16
+
+
+; ----- Define Hardware settings
+ 'LED port directions
+ dir Red out
+ dir green out
+ dir blue out
+
+; ----- Constants
+ ; LCD setup
+ #define LCD_IO 8
+ #define LCD_DATA_PORT PORTC
+ #define LCD_RS PORTD.0
+ #define LCD_RW PORTD.1
+ #define LCD_Enable PORTD.2
+
+ #define Red PORTB.2
+ #define Green PORTB.1
+ #define Blue PORTB.0
+
+; ----- Variables
+ ' No Variables specified in this example. All byte variables are defined upon use.
+
+
+
+; ----- Main body of program commences here.
+ 'Intro message
+ PRINT "Tri-colour LED:"
+ Locate 1, 1
+ PRINT "A GCBASIC Demo"
+ Wait 2 sec
+ Main:
+ For RedLevel = 1 to 200
+ ShowColour Smooth(RedLevel), 1, 1
+ next
+ For GreenLevel = 1 to 200
+ ShowColour 1, Smooth(GreenLevel), 1
+ next
+ For BlueLevel = 1 to 200
+ ShowColour 1, 1, Smooth(BlueLevel)
+ next
+ goto Main
+ end
+
+; ----- Support methods. Subroutines and Functions
+
+
+sub ShowColour(RL, GL, BL)
+ RLTemp = RL+RL
+ ' You can use 0 [zero], or ADC0 or ANO they are mapped to the correct analog port.
+ FlashRate = ReadAD(AN0)
+ for PulseLoop = 1 to FlashRate
+ set red on
+ set green on
+ set blue on
+ for Level = 1 to 200
+ if Level > RLTemp then
+ set red off
+ end if
+ if Level > GL then
+ set green off
+ end if
+ if Level > BL then
+ set blue off
+ end if
+ next
+ next
+end sub
+
+function Smooth(temp)
+ if temp < 100 then
+ Smooth = temp
+ end if
+ if temp >= 100 then
+ Smooth = 200-temp
+ end if
+end sub
+
diff --git a/trunk/workspace/gcb/Mary had a little Lamb with a Table - 16F886.gcb b/trunk/workspace/gcb/Mary had a little Lamb with a Table - 16F886.gcb
new file mode 100644
index 00000000..258837ed
--- /dev/null
+++ b/trunk/workspace/gcb/Mary had a little Lamb with a Table - 16F886.gcb
@@ -0,0 +1,100 @@
+' ########### start ###########
+' pic:PIC16F886
+' ########### end ###########
+
+; FILE: Mary had a little Lamb with a Table - 16F886.gcb
+; DATE: 31.01.2015
+; VERSION: 1.0a
+; AUTHOR: Evan R. Venn based on works of Chuck Hellebuyck
+;
+; Description.
+' A demonstration program for GCGB and GCB.
+' This program plays 'Mary had a little lamb' on portc.2 connected to Piezo speaker.
+' It plays once and stops until the momentary switch on portb.0 is pressed then it plays again.
+'
+
+; This file is part of the Great Cow Basic compiler.
+;
+; This demonstration code is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+; GNU General Public License for more details.
+;
+; ----- Configuration
+ #chip 16F886, 16
+
+; ----- Define Hardware settings
+ DIR portb.0 in
+
+; ----- Constants
+ #define SoundOut portc.2
+
+
+; ----- Variables
+ 'Requires word size to hold note frequencies
+ dim note as word
+
+
+; ----- Main body of program commences here.
+ Do
+ for cnt = 1 to 32
+ readtable mary, cnt, note ' Read notes from table
+ tone note, 50 ' Play notes
+ next
+
+ hold:
+ If D8=1 Then goto hold 'play music when switch is pressed
+
+ Loop
+
+ Table MARY
+ 554 'C#
+ 494 'B
+ 440 'A
+ 494 'B
+ 554 'C#
+ 0 'SILENT
+ 554 'C#
+ 554 'C#
+ 494 'B
+ 0 'SILENT
+ 494 'B
+ 0 'SILENT
+ 494 'B
+ 554 'C#
+ 659 'E
+ 0 'SILENT
+ 659 'E
+ 554 'C#
+ 494 'B
+ 440 'A
+ 494 'B
+ 554 'C#
+ 0 'SILENT
+ 554 'C#
+ 0 'SILENT
+ 554 'C#
+ 494 'B
+ 0 'SILENT
+ 494 'B
+ 554 'C#
+ 494 'B
+ 440 'A
+
+ end table
+
+
+'Tone.gcb
+
+'440 ' A
+'466 ' A#
+'494 ' B
+'523 ' C
+'554 ' C#
+'587 ' D
+'622 ' D#
+'659 ' E
+'699 ' F
+'740 ' F#
+'784 ' G
+'831 ' G#
\ No newline at end of file
diff --git a/trunk/workspace/gcb/MixUART_16f1786.gcb b/trunk/workspace/gcb/MixUART_16f1786.gcb
new file mode 100644
index 00000000..4acdaef6
--- /dev/null
+++ b/trunk/workspace/gcb/MixUART_16f1786.gcb
@@ -0,0 +1,63 @@
+' ########### start ###########
+' pic:PIC16F1786
+' ########### end ###########
+
+; FILE: MixUART_16f1786.gcb.gcb
+; DATE: 31.01.2015
+; VERSION: 1.0a
+; AUTHOR: Evan R. Venn based on works of others
+;
+; Description.
+' A demonstration program for GCGB and GCB.
+' Receive a char from Software-UART and send it back using Hardware-UART.
+
+
+; This file is part of the Great Cow Basic compiler.
+;
+; This demonstration code is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+; GNU General Public License for more details.
+;
+; ----- Configuration
+
+ #chip 16f1786, 4
+
+; ----- Define Hardware settings
+ ' see uart for critical port settings
+
+
+ 'Config Hardware-UART to send with
+ #define USART_BAUD_RATE 2400
+ #define USART_BLOCKING
+ 'Invert UART Tx polarity to connect without max232
+ Set SCKP ON
+ 'Set UART transmit pin to output (Tx)
+ Dir PORTC.6 Out 'Pin 17
+
+ 'Config Software-UART to receive with
+ #define RecAHigh PORTB.7 ON
+ #define RecALow PORTB.7 OFF
+ InitSer 1, r2400, 1+WaitForStart, 8, 1, None, Invert
+ 'Set the pin direction
+ Dir PORTB.7 In 'receive on Pin 40 (RB7/PGD)
+ Wait 100 Ms
+
+
+; ----- Variables
+ ' No Variables specified in this example. All byte variables are defined upon use.
+
+; ----- Main body of program commences here.
+ 'Message after reset
+ HSerPrint " PIC 16f1786"
+ HSerSend 13 ' "Carriage Return"
+ HSerSend 10 ' "Line Feed"
+
+ Start:
+ SerReceive 1, InChar 'wait for char from Software-UART
+ HSerSend InChar 'send back char to Hardware-UART
+ Goto Start
+
+
+
+
diff --git a/trunk/workspace/gcb/Multiple_Devices_Setup_IC2_adapter_Test_SoftwareI2C_mega168.gcb b/trunk/workspace/gcb/Multiple_Devices_Setup_IC2_adapter_Test_SoftwareI2C_mega168.gcb
new file mode 100644
index 00000000..652be6b0
--- /dev/null
+++ b/trunk/workspace/gcb/Multiple_Devices_Setup_IC2_adapter_Test_SoftwareI2C_mega168.gcb
@@ -0,0 +1,106 @@
+' ########### start ###########
+' avr:mega168
+' ########### end ###########
+
+; FILE: Multiple_Devices_Setup_IC2_adapter_Test_SoftwareI2C_mega168.gcb
+; DATE: 17.02.15
+; VERSION: 1.0a
+; AUTHOR: Anobium
+;
+; Description.
+' This demonstration shows an LCD being driven using an LCD I2C adapter.
+' Two types are supported as shown below:
+' Set LCD_10 to 10 for the YwRobot LCD1602 IIC V1 or the Sainsmart LCD_PIC I2C adapter
+' Set LCD_10 to 12 for the Ywmjkdz I2C adapter with pot bent over top of chip
+
+; This file is part of the Great Cow Basic compiler.
+;
+; This demonstration code is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+; GNU General Public License for more details.
+;
+; ----- Configuration
+
+ #chip mega168, 16
+ #config mclr_on
+
+ ; ----- Define Hardware settings
+ ' Define I2C settings - CHANGE PORTS
+ #define I2C_MODE Master
+ #define I2C_DATA PORTC.4
+ #define I2C_CLOCK PORTC.5
+ #define I2C_DISABLE_INTERRUPTS ON
+ 'Optionally, you can reduce the I2C timings.
+ #define I2C_BIT_DELAY 0 us
+ #define I2C_CLOCK_DELAY 1 us
+ #define I2C_END_DELAY 0 us
+
+ '''Set up LCD
+ #define LCD_IO 10
+ #define LCD_I2C_Address_1 0x4E
+ #define LCD_I2C_Address_2 0x4C
+
+; ----- Constants
+ 'None required beyond the scope of the hardware.
+
+; ----- Quick Command Reference:
+
+ '''Set LCD_10 to 10 for the YwRobot LCD1602 IIC V1 or the Sainsmart LCD_PIC I2C adapter
+ '''Set LCD_10 to 12 for the Ywmjkdz I2C adapter with pot bent over top of chip
+
+ ''' #define LCD_I2C_Address 0x4e 'This is the default value, change as appropiate
+ ''' #define LCD_I2C_Address_1 0x4e 'set when multiples are on the bus
+ ''' #define LCD_I2C_Address_2 0x4c
+ ''' #define LCD_I2C_Address_3 0x4a
+ ''' #define LCD_I2C_Address_4 0x49
+ '''
+ ''' Use LCD_I2C_Address_Current = LCD_I2C_Address to change the LCD output routines to a specific device.
+ ''' LCD_I2C_Address_Current = LCD_I2C_Address
+ ''' Print "LCD Address is now": LCDHex( LCD_I2C_Address_Current, 2)
+
+
+; ----- Main body of program commences here.
+do forever
+ LCD_I2C_Address_Current = LCD_I2C_Address_1
+ CLS
+ PRINT "Great Cow Basic"
+ Locate 1,0
+ PRINT "I2C LCD Driver"
+
+
+
+ LCD_I2C_Address_Current = LCD_I2C_Address_2
+ CLS
+ PRINT "Great Cow Basic"
+ Locate 1,0
+ Print "I2C LCD Driver"
+ Locate 2,0
+ Print "By Anobium"
+ Locate 3,0
+ Print "Feb 2015"
+ Wait 3 s
+
+
+ LCD_I2C_Address_Current = LCD_I2C_Address_1
+ repeat 2
+ CLS
+ PRINT "Great Cow Basic"
+ Locate 1,0
+ PRINT "Multiple Devices!"
+
+ LCD_I2C_Address_Current = LCD_I2C_Address_2
+ end repeat
+ wait 3 s
+
+ LCD_I2C_Address_Current = LCD_I2C_Address_1
+ repeat 2
+ cls
+ Print "I2C address:"
+ locate 1,0
+ Print "0x": LCDHex( LCD_I2C_Address_Current, 2)
+ LCD_I2C_Address_Current = LCD_I2C_Address_2
+ end repeat
+
+ wait 3 s
+ loop
\ No newline at end of file
diff --git a/trunk/workspace/gcb/PythonBuild.py b/trunk/workspace/gcb/PythonBuild.py
new file mode 100644
index 00000000..6f114713
--- /dev/null
+++ b/trunk/workspace/gcb/PythonBuild.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+
+import subprocess
+import sys
+import os
+
+actionLine = sys.argv[1]
+projectFile = sys.argv[2]
+
+codeFile = open(projectFile+".gcb", 'r')
+startLine = codeFile.readline()[3:].strip()
+boardLine = codeFile.readline()[3:].strip()
+endLine = codeFile.readline()[3:].strip()
+codeFile.close()
+
+# print projectFile
+# print startLine
+# print actionLine
+# print boardLine
+# print portLine
+# print endLine
+
+family=boardLine.split(':')[0]
+processor=boardLine.split(':')[1]
+#projectFile=projectFile.split(".")[0]
+
+if (startLine != "########### start ###########" or endLine != "########### end ###########"):
+ print("\n Buddy: Error in build-commands - can't process file")
+ sys.exit()
+
+if actionLine=="flash":
+ actionLine=actionLine+"_" + family
+
+gcbCommand = "make " + actionLine + " file=" + projectFile + " cpu=" + processor
+print(gcbCommand)
+
+#print("\n\n -- GreatCowBasic Command --")
+#print(gcbCommand)
+#
+#print("-- Starting %s --\n" %(actionLine))
+#
+presult = subprocess.call(gcbCommand, shell=True)
+#presult = os.system(gcbCommand)
+
+if presult != 0:
+ print("\n Buddy: Failed - result code = %s --" %(presult))
+else:
+ print("\n Buddy: -- Success --")
+
diff --git a/trunk/workspace/gcb/Servo_Demo_16F1829.gcb b/trunk/workspace/gcb/Servo_Demo_16F1829.gcb
new file mode 100644
index 00000000..c51973b2
--- /dev/null
+++ b/trunk/workspace/gcb/Servo_Demo_16F1829.gcb
@@ -0,0 +1,97 @@
+' ########### start ###########
+' pic:PIC16F1829
+' ########### end ###########
+
+'''An Example Program for Great Cow Basic.
+
+'''Control 4 Servos Using 4 Pots and TIMER1
+'''using a Midrange PIC (16F1829)
+
+'''@author Willam Roth
+'''@date 01.04.2015
+'''********************************************************************************
+
+
+ #chip 16F1829, 16
+ ; *** This code only works at 16 Mhz ***
+
+ 'Servo Pins
+ #Define Servo1 PORTB.4
+ #Define Servo2 PORTB.5
+ #Define Servo3 PORTB.6
+ #Define Servo4 PORTB.7
+
+ 'ADC Pins
+ #Define POT1 AN3
+ #Define POT2 AN7
+ #Define POT3 AN8
+ #Define POT4 AN9
+
+ 'Variables
+ DIM SERVOPOS As WORD
+ DIM SERVO1POS AS WORD
+ DIM SERVO2POS AS WORD
+ DIM SERVO3POS AS WORD
+ DIM SERVO4POS AS WORD
+
+ 'Pin Directions
+ DIR Servo1 OUT
+ DIR Servo2 OUT
+ DIR Servo3 OUT
+ DIR Servo4 OUT
+
+ DIR PORTA.4 IN 'AN3
+ DIR PORTC.3 IN 'AN7
+ DIR PORTC.6 IN 'AN8
+ DIR PORTC.7 IN 'AN9
+
+ 'Setup and Start Timer1
+ InitTimer1 Osc, PS1_2
+ TMR1H = 100: TMR1L = 0 'Timer Preload value for 20ms Period
+ On Interrupt timer1overflow call ISR1
+ Starttimer 1
+
+ DO
+ READ_POTS
+ 'Instead of reading POTs we could
+ 'read serial, I2C or HSPI data
+ 'for Servo control data
+ LOOP
+
+
+ SUB ISR1
+' This routine takes ~10 ms to complete with all servos
+' at maximim pulse width.
+ TMR1H = 100: TMR1L = 0 ' timer preload for 20 ms period
+ set Servo1 on: wait SERVO1POS us: set Servo1 off
+ set Servo2 on: wait SERVO2POS us: set Servo2 off
+ set Servo3 on: wait SERVO3POS us: set Servo3 off
+ set Servo4 on: wait SERVO4POS us: set Servo4 off
+ END SUB
+
+ SUB READ_POTS
+
+ SERVOPOS = READAD10(POT1)
+ SERVOPOS = (SERVOPOS * 25 / 16 + 797) '// Map 800 to 2400
+ if servopos < (SERVO1POS - 1) or Servopos > (SERVO1POS + 1) then
+ SERVO1POS = SERVOPOS '// Update & save value
+ end if
+
+ SERVOPOS = READAD10(POT2)
+ SERVOPOS = (SERVOPOS * 25 / 16 + 797) '// Map 800 to 2400
+ if servopos < (SERVO2POS - 1) or Servopos > (SERVO2POS + 1) then
+ SERVO2POS = SERVOPOS '// Update & save value
+ end if
+ SERVOPOS = READAD10(POT3)
+ SERVOPOS = (SERVOPOS * 25 / 16 + 797) '// Map 800 to 2400
+ if servopos < (SERVO3POS - 1) or Servopos > (SERVO3POS + 1) then
+ SERVO3POS = SERVOPOS '// Update & save value
+ end if
+
+ SERVOPOS = READAD10(POT4)
+ SERVOPOS = (SERVOPOS * 25 / 16 + 797) '// Map 800 to 2400
+ if servopos < (SERVO4POS - 1) or Servopos > (SERVO4POS + 1) then
+ SERVO4POS = SERVOPOS '// Update & save value
+ end if
+
+ END SUB
\ No newline at end of file
diff --git a/trunk/workspace/gcb/Software Serial Setup Example - 16F886.gcb b/trunk/workspace/gcb/Software Serial Setup Example - 16F886.gcb
new file mode 100644
index 00000000..b19aa9d8
--- /dev/null
+++ b/trunk/workspace/gcb/Software Serial Setup Example - 16F886.gcb
@@ -0,0 +1,64 @@
+' ########### start ###########
+' pic:PIC16F886
+' ########### end ###########
+
+; FILE: Software Serial Setup Example - 16F886.gcb
+; DATE: 31.01.2015
+; VERSION: 1.0a
+; AUTHOR: Evan R. Venn
+;
+; Description.
+' A serial terminal solution that turns an LED off or on.
+' The LED will be turned ON a '1' is received.
+' The LED will be turned OFF a '0' is received.
+' The LED should be connected to PORTB.5 via appropiate resistors.
+;
+;
+
+; This file is part of the Great Cow Basic compiler.
+;
+; This demonstration code is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+; GNU General Public License for more details.
+;
+; ----- Configuration
+
+ 'PIC 16F886 running at 16 MHz
+ #chip 16F886, 16
+
+; ----- Define Hardware settings
+ 'Set pin directions
+ Dir SerOutPort Out
+ Dir SerInPort In
+
+ DIR portb.5 Out
+
+; ----- Constants
+ 'Setup Serial Port
+ #define SerInPort PORTB.6
+ #define SerOutPort PORTB.7
+ #define SendAHigh Set SerOutPort off
+ #define SendALow Set SerOutPort on
+ #define RecAHigh SerInPort off
+ #define RecALow SerInPort on
+
+
+; ----- Main body of program commences here.
+ InitSer 1, r4800, 1+WaitForStart, 8, 1, none, invert
+ wait 500 ms
+ SerPrint 1, "GCBASIC Serial RS232 Test"
+ SerSend 1, 13
+ SerSend 1, 10
+ Wait 1 s
+ Do
+
+ SerReceive 1, Temp
+ SerSend 1, Temp
+ SerSend 1, 13
+ SerSend 1, 10
+ If Temp = "1" Then Set portb.5 on
+ If Temp = "0" Then Set portb.5 Off
+
+ Loop
+
diff --git a/trunk/workspace/gcb/_MyFiles/Blink_12f1501.gcb b/trunk/workspace/gcb/_MyFiles/Blink_12f1501.gcb
new file mode 100644
index 00000000..c63bcd46
--- /dev/null
+++ b/trunk/workspace/gcb/_MyFiles/Blink_12f1501.gcb
@@ -0,0 +1,16 @@
+'Set chip model:
+#chip 12F1501, 0.25
+'Switch Low-Volt-Programming:
+#config LVP = Off
+
+'Set the pin direction to output:
+' (PORTA.2 = Pin 5 on PIC12f1501)
+Dir PORTA.2 Out
+
+'Main routine
+Start:
+ Set PORTA.2 ON 'turn LED on
+ Wait 100 Ms 'wait 100 milliseconds
+ Set PORTA.2 OFF 'turn LED off
+ Wait 900 Ms 'wait 900 milliseconds
+Goto Start 'jump back to the start of the program
diff --git a/trunk/workspace/gcb/_MyFiles/Blink_12f1822.gcb b/trunk/workspace/gcb/_MyFiles/Blink_12f1822.gcb
new file mode 100644
index 00000000..07af939f
--- /dev/null
+++ b/trunk/workspace/gcb/_MyFiles/Blink_12f1822.gcb
@@ -0,0 +1,16 @@
+'Set chip model:
+#chip 12F1822, 0.5
+'Switch Low-Volt-Programming:
+#config LVP = Off
+
+'Set the pin direction to output:
+' (PORTA.2 = Pin 5 on PIC12f1822)
+Dir PORTA.2 Out
+
+'Main routine
+Start:
+ Set PORTA.2 ON 'turn LED on
+ Wait 100 Ms 'wait 100 milliseconds
+ Set PORTA.2 OFF 'turn LED off
+ Wait 900 Ms 'wait 900 milliseconds
+Goto Start 'jump back to the start of the program
diff --git a/trunk/workspace/gcb/_MyFiles/Blink_12f1824.gcb b/trunk/workspace/gcb/_MyFiles/Blink_12f1824.gcb
new file mode 100644
index 00000000..73b6bbb6
--- /dev/null
+++ b/trunk/workspace/gcb/_MyFiles/Blink_12f1824.gcb
@@ -0,0 +1,15 @@
+'Set chip model:
+#chip 16F1824, 0.5
+#config LVP = ON
+
+'Set the pin direction to output:
+' (PORTA.2 = Pin 5 on PIC12f1822)
+Dir PORTC.2 Out
+
+'Main routine
+Start:
+ Set PORTC.2 ON 'turn LED on
+ Wait 100 Ms 'wait 100 milliseconds
+ Set PORTC.2 OFF 'turn LED off
+ Wait 100 Ms 'wait 900 milliseconds
+Goto Start 'jump back to the start of the program
diff --git a/trunk/workspace/gcb/_MyFiles/Blink_12f1840.gcb b/trunk/workspace/gcb/_MyFiles/Blink_12f1840.gcb
new file mode 100644
index 00000000..4346c04b
--- /dev/null
+++ b/trunk/workspace/gcb/_MyFiles/Blink_12f1840.gcb
@@ -0,0 +1,16 @@
+'Set chip model:
+#chip 12F1840, 0.5
+'Switch Low-Volt-Programming:
+#config LVP = Off
+
+'Set the pin direction to output:
+' (PORTA.2 = Pin 5 on PIC12f1840)
+Dir PORTA.2 Out
+
+'Main routine
+Start:
+ Set PORTA.2 ON 'turn LED on
+ Wait 100 Ms 'wait 100 milliseconds
+ Set PORTA.2 OFF 'turn LED off
+ Wait 900 Ms 'wait 900 milliseconds
+Goto Start 'jump back to the start of the program
diff --git a/trunk/workspace/gcb/_MyFiles/Blink_16f1509.gcb b/trunk/workspace/gcb/_MyFiles/Blink_16f1509.gcb
new file mode 100644
index 00000000..cf28fca9
--- /dev/null
+++ b/trunk/workspace/gcb/_MyFiles/Blink_16f1509.gcb
@@ -0,0 +1,16 @@
+'Set chip model:
+#chip 16F1509, 16
+'Switch Low-Volt-Programming:
+#config LVP = Off
+
+'Set the pin direction to output:
+' (PORTB.6 = Pin 11 on PIC16f1509)
+Dir PORTB.6 Out
+
+'Main routine
+Start:
+ Set PORTB.6 ON 'turn LED on
+ Wait 100 Ms 'wait 100 milliseconds
+ Set PORTB.6 OFF 'turn LED off
+ Wait 900 Ms 'wait 900 milliseconds
+Goto Start 'jump back to the start of the program
diff --git a/trunk/workspace/gcb/_MyFiles/Blink_16f1786.gcb b/trunk/workspace/gcb/_MyFiles/Blink_16f1786.gcb
new file mode 100644
index 00000000..19107eb4
--- /dev/null
+++ b/trunk/workspace/gcb/_MyFiles/Blink_16f1786.gcb
@@ -0,0 +1,16 @@
+'Set chip model:
+#chip 16F1786, 0.5
+'Switch Low-Volt-Programming:
+#config LVP = Off
+
+'Set the pin direction to output:
+' (PORTC.4 = Pin 15 on PIC16f1786)
+Dir PORTC.4 Out
+
+'Main routine
+Start:
+ Set PORTC.4 ON 'turn LED on
+ Wait 100 Ms 'wait 100 milliseconds
+ Set PORTC.4 OFF 'turn LED off
+ Wait 900 Ms 'wait 900 milliseconds
+Goto Start 'jump back to the start of the program
diff --git a/trunk/workspace/gcb/_MyFiles/Blink_16f1824.gcb b/trunk/workspace/gcb/_MyFiles/Blink_16f1824.gcb
new file mode 100644
index 00000000..8e078c89
--- /dev/null
+++ b/trunk/workspace/gcb/_MyFiles/Blink_16f1824.gcb
@@ -0,0 +1,16 @@
+'Set chip model:
+#chip 16F1824, 0.5
+'Switch Low-Volt-Programming:
+#config LVP = Off
+
+'Set the pin direction to output:
+' (PORTC.2 = Pin 8 on PIC16f1824)
+Dir PORTC.2 Out
+
+'Main routine
+Start:
+ Set PORTC.2 ON 'turn LED on
+ Wait 100 Ms 'wait 100 milliseconds
+ Set PORTC.2 OFF 'turn LED off
+ Wait 900 Ms 'wait 900 milliseconds
+Goto Start 'jump back to the start of the program
diff --git a/trunk/workspace/gcb/_MyFiles/Blink_16f1939.gcb b/trunk/workspace/gcb/_MyFiles/Blink_16f1939.gcb
new file mode 100644
index 00000000..c737fafe
--- /dev/null
+++ b/trunk/workspace/gcb/_MyFiles/Blink_16f1939.gcb
@@ -0,0 +1,16 @@
+'Set chip model:
+#chip 16f1939, 4
+'Switch Low-Volt-Programming:
+#config LVP = On
+
+'Set the pin direction to output:
+' (PORTD.2 = Pin 21 on PIC16f1939)
+Dir PORTD.2 Out
+
+'Main routine
+Start:
+ Set PORTD.2 ON 'turn LED on
+ Wait 100 Ms 'wait 100 milliseconds
+ Set PORTD.2 OFF 'turn LED off
+ Wait 900 Ms 'wait 900 milliseconds
+Goto Start 'jump back to the start of the program
\ No newline at end of file
diff --git a/trunk/workspace/gcb/_MyFiles/Blink_16f628A.gcb b/trunk/workspace/gcb/_MyFiles/Blink_16f628A.gcb
new file mode 100644
index 00000000..47554dd5
--- /dev/null
+++ b/trunk/workspace/gcb/_MyFiles/Blink_16f628A.gcb
@@ -0,0 +1,16 @@
+'Set chip model:
+#chip 16F628A, 4
+'Switch Low-Volt-Programming:
+#config LVP = Off
+
+'Set the pin direction to output:
+' (PORTB.4 = Pin 10 on PIC16f628A)
+Dir PORTB.3 Out
+
+'Main routine
+Start:
+ Set PORTB.3 ON 'turn LED on
+ Wait 100 Ms 'wait 100 milliseconds
+ Set PORTB.3 OFF 'turn LED off
+ Wait 900 Ms 'wait 900 milliseconds
+Goto Start 'jump back to the start of the program
diff --git a/trunk/workspace/gcb/_MyFiles/Blink_16f688.gcb b/trunk/workspace/gcb/_MyFiles/Blink_16f688.gcb
new file mode 100644
index 00000000..9b0fe501
--- /dev/null
+++ b/trunk/workspace/gcb/_MyFiles/Blink_16f688.gcb
@@ -0,0 +1,17 @@
+'Set chip model:
+#chip 16F688, 4
+
+'Set the pin direction to output:
+' (PORTC.2 = Pin 8 on PIC16f688)
+Dir PORTC.2 Out
+
+'Main routine
+Start:
+
+ Set PORTC.2 ON 'turn LED on
+ Wait 100 Ms 'wait 100 milliseconds
+
+ Set PORTC.2 OFF 'turn LED off
+ Wait 900 Ms 'wait 900 milliseconds
+
+Goto Start 'jump back to the start of the program
diff --git a/trunk/workspace/gcb/_MyFiles/Blink_16f886.gcb b/trunk/workspace/gcb/_MyFiles/Blink_16f886.gcb
new file mode 100644
index 00000000..460fb381
--- /dev/null
+++ b/trunk/workspace/gcb/_MyFiles/Blink_16f886.gcb
@@ -0,0 +1,15 @@
+'Set chip model:
+#chip 16F886, 4
+#config LVP = Off
+
+'Set the pin direction to output:
+' (PORTB.5 = LED2 on Chipuinos PIC16f886)
+Dir PORTB.5 Out
+
+'Main routine
+Start:
+ Set PORTB.5 ON 'turn LED on
+ Wait 100 Ms 'wait 100 milliseconds
+ Set PORTB.5 OFF 'turn LED off
+ Wait 900 Ms 'wait 900 milliseconds
+Goto Start 'jump back to the start of the program
diff --git a/trunk/workspace/gcb/_MyFiles/Blink_18f13k50.gcb b/trunk/workspace/gcb/_MyFiles/Blink_18f13k50.gcb
new file mode 100644
index 00000000..c1b4a701
--- /dev/null
+++ b/trunk/workspace/gcb/_MyFiles/Blink_18f13k50.gcb
@@ -0,0 +1,16 @@
+'Set chip model:
+#chip 18F13k50, 1
+'Switch Low-Volt-Programming:
+#config LVP = Off
+
+'Set the pin direction to output:
+' (PORTB.6 = Pin 11 on PIC18F13k50)
+Dir PORTB.6 Out
+
+'Main routine
+Start:
+ Set PORTB.6 ON 'turn LED on
+ Wait 100 Ms 'wait 100 milliseconds
+ Set PORTB.6 OFF 'turn LED off
+ Wait 900 Ms 'wait 900 milliseconds
+Goto Start 'jump back to the start of the program
\ No newline at end of file
diff --git a/trunk/workspace/gcb/_MyFiles/Blink_18f14k50.gcb b/trunk/workspace/gcb/_MyFiles/Blink_18f14k50.gcb
new file mode 100644
index 00000000..7bf9eae6
--- /dev/null
+++ b/trunk/workspace/gcb/_MyFiles/Blink_18f14k50.gcb
@@ -0,0 +1,16 @@
+'Set chip model:
+#chip 18F14k50, 1
+'Switch Low-Volt-Programming:
+#config LVP = Off
+
+'Set the pin direction to output:
+' (PORTB.6 = Pin 11 on PIC18F14k50)
+Dir PORTB.6 Out
+
+'Main routine
+Start:
+ Set PORTB.6 ON 'turn LED on
+ Wait 100 Ms 'wait 100 milliseconds
+ Set PORTB.6 OFF 'turn LED off
+ Wait 900 Ms 'wait 900 milliseconds
+Goto Start 'jump back to the start of the program
\ No newline at end of file
diff --git a/trunk/workspace/gcb/_MyFiles/Blink_18f25k20.gcb b/trunk/workspace/gcb/_MyFiles/Blink_18f25k20.gcb
new file mode 100644
index 00000000..7441ceb2
--- /dev/null
+++ b/trunk/workspace/gcb/_MyFiles/Blink_18f25k20.gcb
@@ -0,0 +1,21 @@
+'Set chip model:
+#chip 18F25k20, 2
+'Switch Low-Volt-Programming:
+#config LVP = Off
+
+'Set internal clock speed to 2 MHz:
+Set IRCF0 = 0
+Set IRCF1 = 0
+Set IRCF2 = 1
+
+'Set the pin direction to output:
+' (PORTC.4 = Pin 15 on PIC18F25k20)
+Dir PORTC.4 Out
+
+'Main routine
+Start:
+ Set PORTC.4 ON 'turn LED on
+ Wait 100 Ms 'wait 100 milliseconds
+ Set PORTC.4 OFF 'turn LED off
+ Wait 900 Ms 'wait 900 milliseconds
+Goto Start 'jump back to the start of the program
\ No newline at end of file
diff --git a/trunk/workspace/gcb/_MyFiles/Blink_18f4550.gcb b/trunk/workspace/gcb/_MyFiles/Blink_18f4550.gcb
new file mode 100644
index 00000000..2e5447b3
--- /dev/null
+++ b/trunk/workspace/gcb/_MyFiles/Blink_18f4550.gcb
@@ -0,0 +1,16 @@
+'Set chip model:
+#chip 18F4550, 1
+'Switch Low-Volt-Programming:
+#config LVP = Off
+
+'Set the pin direction to output:
+' (PORTD.2 = Pin 21 on PIC18f4550)
+Dir PORTD.2 Out
+
+'Main routine
+Start:
+ Set PORTD.2 ON 'turn LED on
+ Wait 100 Ms 'wait 100 milliseconds
+ Set PORTD.2 OFF 'turn LED off
+ Wait 900 Ms 'wait 900 milliseconds
+Goto Start 'jump back to the start of the program
diff --git a/trunk/workspace/gcb/_MyFiles/Blink_mega48.gcb b/trunk/workspace/gcb/_MyFiles/Blink_mega48.gcb
new file mode 100644
index 00000000..19d27f5a
--- /dev/null
+++ b/trunk/workspace/gcb/_MyFiles/Blink_mega48.gcb
@@ -0,0 +1,14 @@
+'Set chip model:
+#chip mega48, 1
+
+'Set the pin direction to output:
+' (PORTB.1 = Pin 15 on ATmega48)
+Dir PORTB.1 Out
+
+'Main routine
+Start:
+ Set PORTB.1 ON 'turn LED on
+ Wait 100 Ms 'wait 100 milliseconds
+ Set PORTB.1 OFF 'turn LED off
+ Wait 900 Ms 'wait 900 milliseconds
+Goto Start 'jump back to the start of the program
\ No newline at end of file
diff --git a/trunk/workspace/gcb/_MyFiles/Blink_tiny45.gcb b/trunk/workspace/gcb/_MyFiles/Blink_tiny45.gcb
new file mode 100644
index 00000000..28ae31bf
--- /dev/null
+++ b/trunk/workspace/gcb/_MyFiles/Blink_tiny45.gcb
@@ -0,0 +1,14 @@
+'Set chip model:
+#chip tiny45, 1
+
+'Set the pin direction to output:
+' (PORTB.3 = Pin 2 on ATtiny45)
+Dir PORTB.3 Out
+
+'Main routine
+Start:
+ Set PORTB.3 ON 'turn LED on
+ Wait 100 Ms 'wait 100 milliseconds
+ Set PORTB.3 OFF 'turn LED off
+ Wait 900 Ms 'wait 900 milliseconds
+Goto Start 'jump back to the start of the program
\ No newline at end of file
diff --git a/trunk/workspace/gcb/_MyFiles/HardUART_18f14k50.gcb b/trunk/workspace/gcb/_MyFiles/HardUART_18f14k50.gcb
new file mode 100644
index 00000000..2705c938
--- /dev/null
+++ b/trunk/workspace/gcb/_MyFiles/HardUART_18f14k50.gcb
@@ -0,0 +1,30 @@
+'------------------------------------------
+'Receive a char from UART and send it back.
+'------------------------------------------
+
+'Chip model
+#chip 18F14k50, 1
+
+'Set the pin directions
+Dir PORTB.7 Out 'Tx = Pin 10
+Dir PORTB.5 In 'Rx = Pin 12
+
+'Config UART
+#define USART_BLOCKING
+#define USART_BAUD_RATE 4800
+
+'Invert UART data polarity to connect without max232
+Set CKTXP On 'inverted transmit data polarity
+Set DTRXP On 'inverted receive data polarity
+Wait 100 Ms
+
+'Message after reset
+HSerPrint " 18F14k50"
+HSerSend 13 ' "Carriage Return"
+HSerSend 10 ' "Line Feed"
+
+'Main routine
+Start:
+ HSerReceive InChar 'wait for char from UART
+ HSerSend InChar 'send back char to UART
+Goto Start
\ No newline at end of file
diff --git a/trunk/workspace/gcb/_MyFiles/HardUART_18f25k20.gcb b/trunk/workspace/gcb/_MyFiles/HardUART_18f25k20.gcb
new file mode 100644
index 00000000..528f1d72
--- /dev/null
+++ b/trunk/workspace/gcb/_MyFiles/HardUART_18f25k20.gcb
@@ -0,0 +1,35 @@
+'---------------------------------------------------
+'Receive a char from Hardware-UART and send it back.
+'---------------------------------------------------
+
+'Chip model
+#chip 18F25k20, 4
+
+'Set internal clock speed to 4 MHz:
+Set IRCF0 = 1
+Set IRCF1 = 0
+Set IRCF2 = 1
+
+'Set the pin directions
+Dir PORTC.6 Out 'Tx = Pin 17
+Dir PORTC.7 In 'Rx = Pin 18
+
+'Config UART
+#define USART_BLOCKING
+#define USART_BAUD_RATE 4800
+
+'Invert UART data polarity to connect without max232:
+Set CKTXP On 'inverted transmit data polarity
+Set DTRXP On 'inverted receive data polarity
+Wait 100 Ms
+
+'Message after reset
+HSerPrint " 18F25k20"
+HSerSend 13 ' "Carriage Return"
+HSerSend 10 ' "Line Feed"
+
+'Main routine
+Start:
+ HSerReceive InChar 'wait for char from UART
+ HSerSend InChar 'send back char to UART
+Goto Start
\ No newline at end of file
diff --git a/trunk/workspace/gcb/_MyFiles/HardUART_18f4550.gcb b/trunk/workspace/gcb/_MyFiles/HardUART_18f4550.gcb
new file mode 100644
index 00000000..d3486d7e
--- /dev/null
+++ b/trunk/workspace/gcb/_MyFiles/HardUART_18f4550.gcb
@@ -0,0 +1,30 @@
+'---------------------------------------------------
+'Receive a char from Hardware-UART and send it back.
+'---------------------------------------------------
+
+'Chip model
+#chip 18F4550, 1
+
+'Set the pin directions
+Dir PORTC.6 Out 'Tx = Pin 25
+Dir PORTC.7 In 'Rx = Pin 26
+
+'Config UART
+#define USART_BLOCKING
+#define USART_BAUD_RATE 4800
+
+'Invert UART data polarity to connect without max232:
+Set TXCKP On 'inverted transmit data polarity
+Set RXDTP On 'inverted receive data polarity
+Wait 100 Ms
+
+'Message after reset
+HSerPrint " 18F4550"
+HSerSend 13 ' "Carriage Return"
+HSerSend 10 ' "Line Feed"
+
+'Main routine
+Start:
+ HSerReceive InChar 'wait for char from UART
+ HSerSend InChar 'send back char to UART
+Goto Start
\ No newline at end of file
diff --git a/trunk/workspace/gcb/_MyFiles/MixUART_16f1786.gcb b/trunk/workspace/gcb/_MyFiles/MixUART_16f1786.gcb
new file mode 100644
index 00000000..417ecbd4
--- /dev/null
+++ b/trunk/workspace/gcb/_MyFiles/MixUART_16f1786.gcb
@@ -0,0 +1,34 @@
+'-----------------------------------------------------------------------
+'Receive a char from Software-UART and send it back using Hardware-UART.
+'-----------------------------------------------------------------------
+
+'Set chip model
+#chip 16f1786, 4
+'Set internal oscillator to 4 MHz
+Set IRCF = b'1101'
+
+'Config Hardware-UART to send with
+#define USART_BAUD_RATE 2400
+#define USART_BLOCKING
+'Invert UART Tx polarity to connect without max232
+Set SCKP ON
+'Set UART transmit pin to output (Tx)
+Dir PORTC.6 Out 'Pin 17
+
+'Config Software-UART to receive with
+#define RecAHigh PORTB.7 ON
+#define RecALow PORTB.7 OFF
+InitSer 1, r2400, 1+WaitForStart, 8, 1, None, Invert
+'Set the pin direction
+Dir PORTB.7 In 'receive on Pin 40 (RB7/PGD)
+Wait 100 Ms
+
+'Message after reset
+HSerPrint " PIC 16f1786"
+HSerSend 13 ' "Carriage Return"
+HSerSend 10 ' "Line Feed"
+
+Start:
+ SerReceive 1, InChar 'wait for char from Software-UART
+ HSerSend InChar 'send back char to Hardware-UART
+Goto Start
\ No newline at end of file
diff --git a/trunk/workspace/gcb/_MyFiles/MixUART_16f1939.gcb b/trunk/workspace/gcb/_MyFiles/MixUART_16f1939.gcb
new file mode 100644
index 00000000..804f8437
--- /dev/null
+++ b/trunk/workspace/gcb/_MyFiles/MixUART_16f1939.gcb
@@ -0,0 +1,32 @@
+'-----------------------------------------------------------------------
+'Receive a char from Software-UART and send it back using Hardware-UART.
+'-----------------------------------------------------------------------
+
+'Set chip model
+#chip 16f1939, 4
+
+'Config Hardware-UART to send with
+#define USART_BAUD_RATE 2400
+#define USART_BLOCKING
+'Invert UART Tx polarity to connect without max232
+Set SCKP ON
+'Set UART transmit pin to output (Tx)
+Dir PORTC.6 Out 'Pin 25
+
+'Config Software-UART to receive with
+#define RecAHigh PORTB.7 ON
+#define RecALow PORTB.7 OFF
+InitSer 1, r2400, 1+WaitForStart, 8, 1, None, Invert
+'Set the pin direction
+Dir PORTB.7 In 'receive on Pin 40 (RB7/PGD)
+Wait 100 Ms
+
+'Message after reset
+HSerPrint " PIC 16f1939"
+HSerSend 13 ' "Carriage Return"
+HSerSend 10 ' "Line Feed"
+
+Start:
+ SerReceive 1, InChar 'wait for char from Software-UART
+ HSerSend InChar 'send back char to Hardware-UART
+Goto Start
\ No newline at end of file
diff --git a/trunk/workspace/gcb/_MyFiles/SoftUART_12f1501.gcb b/trunk/workspace/gcb/_MyFiles/SoftUART_12f1501.gcb
new file mode 100644
index 00000000..38a59f25
--- /dev/null
+++ b/trunk/workspace/gcb/_MyFiles/SoftUART_12f1501.gcb
@@ -0,0 +1,32 @@
+'---------------------------------------------------
+'Receive a char from Software-UART and send it back.
+'---------------------------------------------------
+
+'Chip model
+#chip 12f1501, 4
+
+'Set internal oscillator to 4 MHz
+' (writing to IRCF only does not work !?)
+Set OSCCON = b'1101011' 'writing bit 0-6; bit 3-6 = IRCF
+
+'Set the pin directions
+Dir PORTA.2 Out 'send on Pin 5
+Dir PORTA.0 In 'receive on Pin 7 (PCD)
+
+'Config Software-UART
+#define SendAHigh Set PORTA.2 ON
+#define SendALow Set PORTA.2 OFF
+#define RecAHigh PORTA.0 ON
+#define RecALow PORTA.0 OFF
+InitSer 1, r2400, 1+WaitForStart, 8, 1, None, Invert
+
+'Message after reset
+SerPrint 1, " PIC 12f1501"
+SerSend 1, 13 ' "Carriage Return"
+SerSend 1, 10 ' "Line Feed"
+
+'Main routine
+Start:
+ SerReceive 1, InChar 'wait for char from UART
+ SerSend 1, InChar 'send back char to UART
+Goto Start
diff --git a/trunk/workspace/gcb/_MyFiles/SoftUART_12f1840.gcb b/trunk/workspace/gcb/_MyFiles/SoftUART_12f1840.gcb
new file mode 100644
index 00000000..01959749
--- /dev/null
+++ b/trunk/workspace/gcb/_MyFiles/SoftUART_12f1840.gcb
@@ -0,0 +1,29 @@
+'---------------------------------------------------
+'Receive a char from Software-UART and send it back.
+'---------------------------------------------------
+
+'Chip model
+#chip 12f1840, 4
+
+'Set internal oscillator to 4 MHz
+Set IRCF = b'1101'
+
+'Set the pin directions
+Dir PORTA.2 Out 'send on Pin 5
+Dir PORTA.0 In 'receive on Pin 7 (PCD)
+
+'Config Software-UART
+#define SendAHigh Set PORTA.2 ON
+#define SendALow Set PORTA.2 OFF
+#define RecAHigh PORTA.0 ON
+#define RecALow PORTA.0 OFF
+InitSer 1, r2400, 1+WaitForStart, 8, 1, None, Invert
+
+SerPrint 1, " PIC 12f1280"
+SerSend 1, 13 ' "Carriage Return"
+SerSend 1, 10 ' "Line Feed"
+
+Start:
+ SerReceive 1, InChar 'wait for char from UART
+ SerSend 1, InChar 'send back char to UART
+Goto Start
\ No newline at end of file
diff --git a/trunk/workspace/gcb/adc_lightsensor.gcb b/trunk/workspace/gcb/adc_lightsensor.gcb
new file mode 100644
index 00000000..fc0b653c
--- /dev/null
+++ b/trunk/workspace/gcb/adc_lightsensor.gcb
@@ -0,0 +1,24 @@
+' ########### start ###########
+' pic:PIC16F886
+' ########### end ###########
+
+'This program monitors a photoresistor connected
+' to the AN1 pin. If its in the dark it will
+' light the LED on D13. If its in the light
+' then LED is shutoff.
+
+'Chip Settings
+#chip 16F886,16
+#include
+Dir D13 out 'Make D15 pin output
+Start:
+Do
+'Light LED if in the dark
+If ReadAD(AN1) < 150 Then
+ set D13 on 'Sensor is Dark
+ else
+ set D13 off 'Bright light on sensor
+end if
+
+Loop
+
diff --git a/trunk/workspace/gcb/adc_pot.gcb b/trunk/workspace/gcb/adc_pot.gcb
new file mode 100644
index 00000000..09c3d6ce
--- /dev/null
+++ b/trunk/workspace/gcb/adc_pot.gcb
@@ -0,0 +1,45 @@
+' ########### start ###########
+' pic:PIC16F886
+' ########### end ###########
+
+'This program reads the potentiometer on AN0 and lights
+' the LEDs connected to PORTB to form a bar graph
+' that indicates how far the pot has been turned.
+' This is similar to the volume display on a stereo
+
+'Chip Settings
+#chip 16F886,16
+
+Dir PORTB Out
+Start:
+
+'Light all LEDs if pot turned all way to right
+If ReadAD(AN0) > 230 Then
+ PORTB = b'00111100'
+ Goto Start
+end if
+
+'Three LEDs lit
+If ReadAD(AN0) > 180 Then
+ PORTB = b'00011100'
+ Goto Start
+end if
+
+'Two LEDs lit
+If ReadAD(AN0) > 100 Then
+ PORTB = b'00001100'
+ Goto Start
+end if
+
+'One LED lit
+If ReadAD(AN0) > 10 Then
+ PORTB = b'00000100'
+ Goto Start
+end if
+
+'All LEDs off, Pot all way to left
+If ReadAD(AN0) < 10 Then
+ PORTB = 0
+end if
+Goto Start
+
diff --git a/trunk/workspace/gcb/blinkled.gcb b/trunk/workspace/gcb/blinkled.gcb
new file mode 100644
index 00000000..816807ad
--- /dev/null
+++ b/trunk/workspace/gcb/blinkled.gcb
@@ -0,0 +1,20 @@
+' ########### start ###########
+' pic:PIC16F886
+' ########### end ###########
+
+'A program to flash LED on PIN 13/PORTB5
+
+'Chip model
+#chip 16F886, 16
+
+'Main routine
+Start:
+ 'Turn one LED on, the other off
+ SET PORTB.5 ON
+ wait 1 sec
+ 'Now toggle the LEDs
+ SET PORTB.5 OFF
+ wait 1 sec
+ 'Jump back to the start of the program
+goto Start
+
diff --git a/trunk/workspace/gcb/blinkled_binary.gcb b/trunk/workspace/gcb/blinkled_binary.gcb
new file mode 100644
index 00000000..f8747eeb
--- /dev/null
+++ b/trunk/workspace/gcb/blinkled_binary.gcb
@@ -0,0 +1,20 @@
+' ########### start ###########
+' pic:PIC16F886
+' ########### end ###########
+
+'A program to flash LED on PIN 13/PORTB5
+
+'Chip model
+#chip 16F886, 16
+
+'Main routine
+Start:
+ 'Turn one LED on, the other off
+ PORTB = b'00100000' ' PORTB.5, D13 LED on
+ wait 1 sec
+ 'Now toggle the LEDs
+ PORTB = b'00000000' ' PORTB.5, D13 LED off
+ wait 1 sec
+ 'Jump back to the start of the program
+goto Start
+
diff --git a/trunk/workspace/gcb/blinkled_include.gcb b/trunk/workspace/gcb/blinkled_include.gcb
new file mode 100644
index 00000000..4f4d02ad
--- /dev/null
+++ b/trunk/workspace/gcb/blinkled_include.gcb
@@ -0,0 +1,21 @@
+' ########### start ###########
+' pic:PIC16F886
+' ########### end ###########
+
+'A program to flash LED on PIN 13/PORTB5
+
+'Chip model
+#chip 16F886, 16
+#include ' Define CHIPINO I/O pins
+
+'Main routine
+Start:
+ 'Turn one LED on, the other off
+ SET D13 ON
+ wait 1 sec
+ 'Now toggle the LEDs
+ SET D13 OFF
+ wait 1 sec
+ 'Jump back to the start of the program
+goto Start
+
diff --git a/trunk/workspace/gcb/dfrobot_lcd.gcb b/trunk/workspace/gcb/dfrobot_lcd.gcb
new file mode 100644
index 00000000..ee4646ec
--- /dev/null
+++ b/trunk/workspace/gcb/dfrobot_lcd.gcb
@@ -0,0 +1,28 @@
+' ########### start ###########
+' pic:PIC16F886
+' ########### end ###########
+
+;Chip Settings
+#chip 16F886,16
+'#config MCLRE = on 'enable reset switch on CHIPINO
+
+#define LCD_NO_RW 'Needed when RW is grounded
+;Defines (Constants)
+#define LCD_IO 4
+#define LCD_RS PORTB.0
+#define LCD_Enable PORTB.1
+#define LCD_DB4 PORTC.3
+#define LCD_DB5 PORTC.2
+#define LCD_DB6 PORTC.1
+#define LCD_DB7 PORTC.0
+Dir Portb.2 in ' Backlight on
+
+Start:
+CLS
+Locate 0,0 'Move to first line first column
+Print "Hello" 'Print "Hello" on first line
+locate 1,3 'Move to 2nd line column
+print "World"
+Wait 10 s
+Goto Start
+
diff --git a/trunk/workspace/gcb/dotmatrix.gcb b/trunk/workspace/gcb/dotmatrix.gcb
new file mode 100644
index 00000000..778185af
--- /dev/null
+++ b/trunk/workspace/gcb/dotmatrix.gcb
@@ -0,0 +1,367 @@
+' ########### start ###########
+' pic:PIC16F886
+' ########### end ###########
+
+'A program to drive the LED Matrix Shield
+'Display the 0 symbol
+
+'Chip model
+#chip 16F886, 16
+#include
+'#include "Characters.gcb" ;character pattern data in tables
+
+'Main routine
+Start:
+TRISA = 0
+TRISB = 0
+TRISC = 0
+
+DIM COLUMN(8) AS BYTE
+FOR DIG = 1 TO 239 STEP 8 ; Display ascii
+INDEX = DIG
+FOR CNT = 1 TO 8
+ReadTable NUMERIC, INDEX, COLUMN(CNT)
+INDEX++
+NEXT
+FOR TIME = 1 TO 50
+ROW = 1
+FOR CNT = 1 TO 8
+'Columns need to be pulled low to light
+ D9 = COLUMN(CNT).0
+ D8 = COLUMN(CNT).1
+ D4 = COLUMN(CNT).2
+ A3 = COLUMN(CNT).3
+ D3 = COLUMN(CNT).4
+ D10 = COLUMN(CNT).5
+ D11 = COLUMN(CNT).6
+ D6 = COLUMN(CNT).7
+'Rows are driven high to light LED
+ D2 = ROW.0
+ D7 = ROW.1
+ A5 = ROW.2
+ D5 = ROW.3
+ D13 = ROW.4
+ A4 = ROW.5
+ D12 = ROW.6
+ A2 = ROW.7
+ROW = ROW*2
+wait 1 mS
+NEXT
+NEXT
+NEXT
+ 'Jump back to the start of the program
+goto Start
+
+table numeric ;5 by 7 patterns, ASCII 32 through 63
+ ;space 1
+ 0xFF
+ 0xFF
+ 0xFF
+ 0xFF
+ 0xFF
+ 0xFF
+ 0xFF
+ 0xFF
+
+ ;! 9
+ 0xFF
+ 0xFB
+ 0xFB
+ 0xFB
+ 0xFB
+ 0xFB
+ 0xFF
+ 0xFB
+
+ ;" 17
+ 0xFF
+ 0xFA
+ 0xF5
+ 0xFF
+ 0xFF
+ 0xFF
+ 0xFF
+ 0xFF
+
+ ;# 25
+ 0xFF
+ 0xFF
+ 0xF5
+ 0xE0
+ 0xF5
+ 0xE0
+ 0xF5
+ 0xFF
+
+ ;$ 33
+ 0xFF
+ 0xFB
+ 0xF0
+ 0xEB
+ 0xF1
+ 0xFA
+ 0xE1
+ 0xFB
+
+ ;% 41
+ 0xFF
+ 0xE3
+ 0xEA
+ 0xE1
+ 0xFB
+ 0xF0
+ 0xEA
+ 0xF8
+
+ ;& 49
+ 0xFF
+ 0xF9
+ 0xF6
+ 0xE7
+ 0xF7
+ 0xEA
+ 0xED
+ 0xF2
+
+ ;‘ 57
+ 0xFF
+ 0xEF
+ 0xF7
+ 0xFB
+ 0xFF
+ 0xFF
+ 0xFF
+ 0xFF
+
+ ;( 65
+ 0xFF
+ 0xFD
+ 0xFB
+ 0xF7
+ 0xF7
+ 0xF7
+ 0xFB
+ 0xFD
+
+ ;) 73
+ 0xFF
+ 0xF7
+ 0xFB
+ 0xFD
+ 0xFD
+ 0xFD
+ 0xFB
+ 0xF7
+
+ ;* 81
+ 0xFF
+ 0xFB
+ 0xEA
+ 0xF1
+ 0xF1
+ 0xEA
+ 0xFB
+ 0xFF
+
+ ;+ 89
+ 0xFF
+ 0xFF
+ 0xFB
+ 0xFB
+ 0xE0
+ 0xFB
+ 0xFB
+ 0xFF
+
+ ;, 97
+ 0xFF
+ 0xFF
+ 0xFF
+ 0xFF
+ 0xFD
+ 0xFD
+ 0xFB
+ 0xF7
+
+ ;- 105
+ 0xFF
+ 0xFF
+ 0xFF
+ 0xE0
+ 0xFF
+ 0xFF
+ 0xFF
+ 0xFF
+
+ ;. 113
+ 0xFF
+ 0xFF
+ 0xFF
+ 0xFF
+ 0xFF
+ 0xF8
+ 0xF8
+ 0xF8
+
+ ;/ 121
+ 0xFF
+ 0xFF
+ 0xFE
+ 0xFD
+ 0xFB
+ 0xF7
+ 0xEF
+ 0xFF
+
+ ;0 129 (CORRECTED)
+ 0xFF
+ 0xf1
+ 0xEE
+ 0xE6
+ 0xEA
+ 0xEC
+ 0xEE
+ 0xF1
+
+ ;1 137 (CORR)
+ 0xFF
+ 0xFB
+ 0xF3
+ 0xFB
+ 0xFB
+ 0xFB
+ 0xFB
+ 0xF1
+
+ ;2 147
+ 0xFF
+ 0xF1
+ 0xEE
+ 0xFE
+ 0xFD
+ 0xFB
+ 0xF7
+ 0xE0
+
+ ;3 155
+ 0xFF
+ 0xF1
+ 0xEE
+ 0xFE
+ 0xF9
+ 0xFE
+ 0xEE
+ 0xF1
+
+ ;4 163
+ 0xFF
+ 0xED
+ 0xED
+ 0xED
+ 0xE0
+ 0xFD
+ 0xFD
+ 0xFD
+
+ ;5 171
+ 0xFF
+ 0xE0
+ 0xEF
+ 0xEF
+ 0xE1
+ 0xFE
+ 0xFE
+ 0xE1
+
+ ;6 179
+ 0xFF
+ 0xF1
+ 0xEE
+ 0xEF
+ 0xE1
+ 0xEE
+ 0xEE
+ 0xF1
+
+ ;7 183
+ 0xFF
+ 0xE0
+ 0xFE
+ 0xFE
+ 0xFD
+ 0xFB
+ 0xFB
+ 0xFB
+
+ ;8 191
+ 0xFF
+ 0xF1
+ 0xEE
+ 0xEE
+ 0xF1
+ 0xEE
+ 0xEE
+ 0xF1
+
+ ;9 199
+ 0xFF
+ 0xF1
+ 0xEE
+ 0xEE
+ 0xF0
+ 0xFE
+ 0xFE
+ 0xF1
+
+ ;: 207
+ 0xFF
+ 0xFF
+ 0xF9
+ 0xF9
+ 0xFF
+ 0xF9
+ 0xF9
+ 0xFF
+
+ ;; 215
+ 0xFF
+ 0xFF
+ 0xF9
+ 0xF9
+ 0xFF
+ 0xFD
+ 0xFB
+ 0xF7
+
+ ;< 223
+ 0xFF
+ 0xFD
+ 0xFB
+ 0xF7
+ 0xEF
+ 0xF7
+ 0xFB
+ 0xFD
+
+ ;= 231
+ 0xFF
+ 0xFF
+ 0xFF
+ 0xE0
+ 0xFF
+ 0xE0
+ 0xFF
+ 0xFF
+
+ ;> 239
+ 0xFF
+ 0xF7
+ 0xFB
+ 0xFD
+ 0xFE
+ 0xFD
+ 0xFB
+ 0xF7
+
+
+end table
\ No newline at end of file
diff --git a/trunk/workspace/gcb/glcd.gcb b/trunk/workspace/gcb/glcd.gcb
new file mode 100644
index 00000000..71c26715
--- /dev/null
+++ b/trunk/workspace/gcb/glcd.gcb
@@ -0,0 +1,45 @@
+' ########### start ###########
+' pic:PIC16F886
+' ########### end ###########
+
+;Chip Settings
+#chip 16F886,16
+'#config MCLRE = on 'enable reset switch on CHIPINO
+#include
+#include
+
+;Defines (Constants)
+#define GLCD_RW PORTB.1 'D9 to pin 5 of LCD
+#define GLCD_RESET PORTB.5 'D13 to pin 17 of LCD
+#define GLCD_CS1 PORTB.3 'D12 to actually since CS1, CS2 are backward
+#define GLCD_CS2 PORTB.4 'D11 to actually since CS1, CS2 are backward
+#define GLCD_RS PORTB.0 'D8 to pin 4 D/I pin on LCD
+#define GLCD_ENABLE PORTB.2 'D10 to Pin 6 on LCD
+#define GLCD_DB0 PORTC.7 'D0 to pin 7 on LCD
+#define GLCD_DB1 PORTC.6 'D1 to pin 8 on LCD
+#define GLCD_DB2 PORTC.5 'D2 to pin 9 on LCD
+#define GLCD_DB3 PORTC.4 'D3 to pin 10 on LCD
+#define GLCD_DB4 PORTC.3 'D4 to pin 11 on LCD
+#define GLCD_DB5 PORTC.2 'D5 to pin 12 on LCD
+#define GLCD_DB6 PORTC.1 'D6 to pin 13 on LCD
+#define GLCD_DB7 PORTC.0 'D7 to pin 14 on LCD
+
+InitGLCD
+Start:
+GLCDCLS
+GLCDPrint 0,10,"Hello" 'Print Hello
+wait 5 s
+GLCDPrint 0,10, "ASCII #:" 'Print ASCII #:
+Box 18,30,28,40 'Draw Box Around ASCII Character
+for char = 15 to 129 'Print 0 through 9
+GLCDPrint 17, 20 , Str(char)
+GLCDdrawCHAR 20,30, char
+wait 1 s
+next
+line 0,50,127,50 'Draw Line using line command
+for xvar = 0 to 80 'draw line using Pset command
+pset xvar,63,on '
+next '
+Wait 10 s
+Goto Start
+
diff --git a/trunk/workspace/gcb/keypad.gcb b/trunk/workspace/gcb/keypad.gcb
new file mode 100644
index 00000000..eed96f56
--- /dev/null
+++ b/trunk/workspace/gcb/keypad.gcb
@@ -0,0 +1,53 @@
+' ########### start ###########
+' pic:PIC16F886
+' ########### end ###########
+
+'Keypad.gcb
+'This program reads a keypad and sends the key pressed to the PICkit 2 UART Tool
+'Rows are connected to PORTB pins D11-D8
+'Columns are connected to PORTC pins D7-D4
+'Column pins must be pulled up to 5v through 10k Resistors.
+
+;Chip Settings
+#chip 16F886,16
+#include
+
+'Serial settings
+#define SerInPort PORTB.6
+#define SerOutPort PORTB.7
+#define SendAHigh Set SerOutPort off
+#define SendALow Set SerOutPort on
+#define RecAHigh SerInPort off
+#define RecALow SerInPort on
+
+'Set pin directions
+Dir SerOutPort Out
+Dir SerInPort In
+
+;Defines (Constants)
+#define KEYPAD_ROW_1 D11
+#define KEYPAD_ROW_2 D10
+#define KEYPAD_ROW_3 D9
+#define KEYPAD_ROW_4 D8
+#define KEYPAD_COL_1 D7
+#define KEYPAD_COL_2 D6
+#define KEYPAD_COL_3 D5
+#define KEYPAD_COL_4 D4
+
+'Main loop
+InitSer 1, r9600, 1+waitforstart, 8, 1, none, invert
+Do
+ 'Get key
+ Temp = KeypadData
+
+ 'If a key is pressed, then display it
+ If Temp <> KEY_NONE Then
+' CLS
+' Print Temp
+ SerSend 1, Temp
+ Wait 100 ms
+ End If
+Loop
+
+
+
diff --git a/trunk/workspace/gcb/led_display.gcb b/trunk/workspace/gcb/led_display.gcb
new file mode 100644
index 00000000..2d645746
--- /dev/null
+++ b/trunk/workspace/gcb/led_display.gcb
@@ -0,0 +1,32 @@
+' ########### start ###########
+' pic:PIC16F886
+' ########### end ###########
+
+'A program to drive LED Display
+'Program will count from 0 to 9 and then repeat
+
+'Chip model
+#chip 16F886, 16
+#include ' Define CHIPINO I/O pins
+
+#define DISP_COUNT 1
+#define DISP_SEG_A D7
+#define DISP_SEG_B D6
+#define DISP_SEG_C D5
+#define DISP_SEG_D D4
+#define DISP_SEG_E D3
+#define DISP_SEG_F D2
+#define DISP_SEG_G D1
+#define DISP_SEG_DOT D0
+DIR PORTC out
+temp = 0
+
+main:
+displayValue 1,temp
+wait 1 s
+temp = temp + 1
+if temp > 9 then
+temp = 0
+end if
+goto main
+
diff --git a/trunk/workspace/gcb/makeGCB.py b/trunk/workspace/gcb/makeGCB.py
new file mode 100644
index 00000000..d236a661
--- /dev/null
+++ b/trunk/workspace/gcb/makeGCB.py
@@ -0,0 +1,70 @@
+#!/usr/bin/env python
+
+import subprocess
+import sys
+import platform
+import os
+
+actionLine = sys.argv[1]
+projectFile = sys.argv[2]
+picprg = 'PK2'
+if len(sys.argv)>3:
+ picprg = sys.argv[3]
+
+codeFile = open(projectFile+".gcb", 'r')
+startLine = codeFile.readline()[3:].strip()
+boardLine = codeFile.readline()[3:].strip()
+endLine = codeFile.readline()[3:].strip()
+codeFile.close()
+
+sistema=platform.system()
+family=boardLine.split(':')[0]
+processor=boardLine.split(':')[1]
+
+if (startLine != "########### start ###########" or endLine != "########### end ###########"):
+ print("\nMake-GCB: Error in build-commands - can't process file")
+ sys.exit()
+
+if sistema=='Windows':
+ DIRGCB='E:/Progs/GreatCowBasic'
+elif sistema=='Darwin':
+ DIRGCB='/Users/topicchi/Progs/GreatCowBasic'
+else:
+ DIRGCB='/usr/share/GcBasic'
+
+CC='gcbasic'
+OBJDIR='./Release'
+if not (os.path.isdir(OBJDIR)):
+ os.makedirs(OBJDIR)
+
+gcbCommand = "%s/%s -O:%s/%s.asm -A:GCASM -K:A -V -NP %s.gcb" %(DIRGCB, CC, OBJDIR, projectFile, projectFile)
+if picprg=='PK3':
+ flashCommandPIC = "/opt/microchip/mplabx/mplab_ipe/ipecmd.sh -P%s -F%s/%s.hex -M -TPPK3 -W" %(processor[3:], OBJDIR, projectFile)
+else:
+ flashCommandPIC = "pk2cmd -p%s -f%s/%s.hex -m -r -t" %(processor, OBJDIR, projectFile)
+flashCommandAVR = "avrdude -B 10 -c USBasp -p AT%s -U flash:w:%s/%s.hex:a" %(processor, OBJDIR, projectFile)
+#print flashCommandPIC
+
+presult=0
+if actionLine=="build":
+ print(gcbCommand)
+ presult = subprocess.call(gcbCommand, shell=True)
+
+if actionLine=="flash":
+ hexFile="%s/%s.hex" %(OBJDIR, projectFile)
+ if not os.path.isfile(hexFile):
+ print "\nMake-GCB: generating HEX: %s" %(hexFile)
+ print(gcbCommand)
+ presult = subprocess.call(gcbCommand, shell=True)
+
+ if family=="pic":
+ flashCommand=flashCommandPIC
+ else:
+ flashCommand=flashCommandAVR
+ presult = subprocess.call(flashCommand, shell=True)
+
+if presult != 0:
+ print("\nMake-GCB: Failed - result code = %s --" %(presult))
+else:
+ print("\nMake-GCB: -- Success --")
+
diff --git a/trunk/workspace/gcb/makefile b/trunk/workspace/gcb/makefile
new file mode 100644
index 00000000..76adaf77
--- /dev/null
+++ b/trunk/workspace/gcb/makefile
@@ -0,0 +1,55 @@
+#
+# Makefile for GCBasic
+# 24.04.2015 - Paolo Iocco
+#
+# Usage:
+# make build file=10f200-blink cpu=PIC10F200
+# make flash_pic file=10f200-blink cpu=PIC10F200
+# make build file=tiny88-blink cpu=tiny88
+# make flash_avr file=tiny88-blink cpu=tiny88
+#
+
+#global variables
+CC = gcbasic
+OBJDIR=./Release
+ifeq ($(OS),Windows_NT)
+ DIRGCB = E:/Progs/GreatCowBasic
+else
+ DIRGCB = /usr/share/GcBasic
+endif
+
+# Default values for file and processor
+file = main
+cpu = PIC16C84
+
+# Start of rules
+
+default:
+ @echo Please specify a "rule", "file" and a "cpu"
+
+dir:
+ @echo
+ @echo Makefile for GreatCowBasic V1.0
+ @echo 24.04.2015 - Paolo Iocco
+ @echo
+ @echo Tools located at $(DIRGCB)
+ test -d $(OBJDIR) || mkdir $(OBJDIR)
+ @echo
+
+build: dir
+ @echo compiling: $(file).gcb for processor: $(cpu)
+ @echo
+ $(DIRGCB)/$(CC) -O:$(OBJDIR)/$(file).asm -A:GCASM -K:A -V -NP $(file).gcb
+ @echo
+
+flash_pic: $(OBJDIR)/$(file).hex
+ @echo flashing $(file).hex for processor: $(cpu)
+ @echo
+ pk2cmd -p$(cpu) -f$(OBJDIR)/$(file).hex -m -r -t
+ @echo
+
+flash_avr: $(OBJDIR)/$(file).hex
+ @echo flashing $(OBJDIR)/$(file).hex for processor: $(cpu)
+ @echo
+ avrdude -c USBasp -p AT$(cpu) -U flash:w:$(OBJDIR)/$(file).hex:a
+ @echo
diff --git a/trunk/workspace/gcb/makefile.old b/trunk/workspace/gcb/makefile.old
new file mode 100644
index 00000000..8dbadae7
--- /dev/null
+++ b/trunk/workspace/gcb/makefile.old
@@ -0,0 +1,59 @@
+#
+# Makefile for GCBasic
+# 24.04.2015 - Paolo Iocco
+#
+# Usage:
+# make build file=10f200-blink cpu=PIC10F200
+# make flash_pic file=10f200-blink cpu=PIC10F200
+# make build file=tiny88-blink cpu=tiny88
+# make flash_avr file=tiny88-blink cpu=tiny88
+#
+#
+# pk2cmd -pPIC16C84 -f%e.hex -m -r -t
+# avrdude -c USBasp -P usb -p AT%2 -U flash:w:%1:i
+#
+
+#global variables
+CC = gcbasic
+OBJDIR=./Release
+ifeq ($(OS),Windows_NT)
+ DIRGCB = E:/GCB@Syn/GreatCowBasic
+else
+ DIRGCB = /usr/share/GCBasic
+endif
+
+# Default values for file and processor
+file = main
+cpu = PIC16C84
+
+# Start of rules
+
+default:
+ @echo Please specify a "rule", "file" and a "cpu"
+
+dir:
+ @echo
+ @echo Makefile for GreatCowBasic. V0.9
+ @echo 24.04.2015 - Paolo Iocco
+ @echo
+ @echo Tools located at $(DIRGCB)
+ test -d $(OBJDIR) || mkdir $(OBJDIR)
+ @echo
+
+build: dir
+ @echo compiling: $(file).gcb for processor: $(cpu)
+ @echo
+ $(DIRGCB)/$(CC) -O:$(OBJDIR)/$(file).asm -A:GCASM -K:A -V -NP $(file).gcb
+ @echo
+
+flash_pic: $(OBJDIR)/$(file).hex
+ @echo flashing $(file).hex for processor: $(cpu)
+ @echo
+ pk2cmd -p$(cpu) -f$(OBJDIR)/$(file).hex -m -r -t
+ @echo
+
+flash_avr: $(OBJDIR)/$(file).hex
+ @echo flashing $(OBJDIR)/$(file).hex for processor: $(cpu)
+ @echo
+ avrdude -c USBasp -P usb -p AT$(cpu) -U flash:w:$(OBJDIR)/$(file).hex:i
+ @echo
\ No newline at end of file
diff --git a/trunk/workspace/gcb/mega1284-BreadBoard.gcb b/trunk/workspace/gcb/mega1284-BreadBoard.gcb
new file mode 100644
index 00000000..b78f9d1d
--- /dev/null
+++ b/trunk/workspace/gcb/mega1284-BreadBoard.gcb
@@ -0,0 +1,124 @@
+' ########### start ###########
+' avr:mega1284p
+' ########### end ###########
+'
+' ******************************************************************
+' EPROM Emulator with ATMega1284(p)
+' 2016-08-23 (c) Paolo Iocco
+' ******************************************************************
+'
+' Circuit diagram
+' ATmega 1284 Pin map
+' +-\/-+
+' PB0--1|o |40--PA0----GLCD.RES
+' PB1--2| |39--PA1----GLCD.CS
+' PB2--3| |38--PA2----GLCD.DC
+' PB3--4| |37--PA3----GLCD.DO
+' PB4--5| |36--PA4----GLCD.SCK
+' MOSI-PB5--6| |35--PA5
+' MISO-PB6--7| |34--PA6
+' SCK--PB7--8| |33--PA7
+' /Reset 9| |32 AREF
+' VCC 10| |31 GND
+' GND 11| |30 AVCC
+' XTAL1 12| |29--PC7
+' XTAL2 13| |28--PC6
+' RXD0---------PD0-14| |27--PC5
+' TXD0---------PD1-15| |26--PC4
+' PD2 16| |25--PC3
+' PD3 17| |24--PC2
+' PD4 18| |23--PC1
+' PD5 19| |22--PC0
+' PD6 20| |21 PD7
+' +----+
+' ******************************************************************
+' 9.6MHz:
+' LFuse: 0xxx; HFuse: 0xxx;
+' AVRDude: -U lfuse:w:0xxx:m -U hfuse:w:0xxx:m
+'
+' ******************************************************************
+
+#chip mega1284p,16
+
+'#option explicit
+#define GLCD_TYPE GLCD_TYPE_PCD8544
+#include
+
+' Pin mapping
+#define GLCD_RESET porta.0
+#define GLCD_CS porta.1
+#define GLCD_DC porta.2
+#define GLCD_DO porta.3
+#define GLCD_SCK porta.4
+dim longNumber as long
+dim wordNumber as word
+dim byteNumber as byte
+dim indexvalue as byte
+dim CCount as byte
+dim temp as byte
+
+setup:
+longNumber=0
+wordNumber=0
+byteNumber=0
+Write_Command_PCD8544(0x21) 'Activate Chip and H=1.
+Write_Command_PCD8544(0xC2) 'Set LCD Voltage
+Write_Command_PCD8544(0x06) 'temperature correction
+Write_Command_PCD8544(0x13) 'set bias system
+Write_Command_PCD8544(0x20) 'set LCD mode:PDown=0, Vaddr=0, Hext=0
+Write_Command_PCD8544(0x09) 'Activate all segments.
+Clear_RAM_PCD8544() 'Erase all pixel on the DDRAM.
+Write_Command_PCD8544(0x08) 'Blank the Display.
+Write_Command_PCD8544(0x0C) 'Display Normal.
+GLCDCLS
+
+Table tabella as byte
+ 0x01, 0x02, 0x03, 0x04
+ 0x02, 0x03, 0x04, 0x05
+ 0x03, 0x04, 0x05, 0x06
+ 0x04, 0x05, 0x06, 0x07
+end Table
+
+GLCDPrint(0, 0, "Done.")
+
+loop:
+DO forever
+ pippo
+LOOP
+
+Sub pippo;
+ for CCount = 31 to 127
+ indexvalue = CCount/16
+ readtable Tabella,indexvalue,temp
+ GLCDPrint(0, 0, "PrintStr")
+ GLCDDrawString(0, 9, "DrawStr")
+ GLCDPrint(44, 21, " ")
+ GLCDPrint(44, 29, " ") ' word value
+ GLCDPrint(44, 37, " ") ' Byte value
+ GLCDPrint(44, 21, hex(longNumber_U))
+ GLCDPrint(56, 21, hex(longNumber_H))
+ GLCDPrint(68, 21, hex(longNumber))
+ GLCDPrint(44, 29, mid( str(wordNumber),1, 6))
+ GLCDPrint(44, 37, byteNumber)
+
+ box 46,9,57,19
+ GLCDDrawChar(48, 9, CCount )
+ FilledBox(58,9,GLCD_WIDTH-1,17,GLCDBackground ) 'draw a box to overwrite existing strings
+ GLCDPrint(58, 9, str( CCount ))
+
+ box 0,0,GLCD_WIDTH-1, GLCD_HEIGHT-1
+ box GLCD_WIDTH-5, GLCD_HEIGHT-5,GLCD_WIDTH- 1, GLCD_HEIGHT-1
+
+ Circle( 25,30,8,1)
+ 'filledbox 2,30,6,38, wordNumber
+ 'FilledCircle( 25,30,4,longNumber xor 1)
+ 'line 0, GLCD_HEIGHT-1 , GLCD_WIDTH/2, (GLCD_HEIGHT /2) +1
+ 'line GLCD_WIDTH/2, (GLCD_HEIGHT /2) +1 ,0, (GLCD_HEIGHT /2) +1
+
+ longNumber = longNumber + 7
+ wordNumber = wordNumber + 3
+ byteNumber++
+ NEXT
+End Sub
+
+end
diff --git a/trunk/workspace/gcb/mega1284-Eprom_Programmer.gcb b/trunk/workspace/gcb/mega1284-Eprom_Programmer.gcb
new file mode 100644
index 00000000..0708e351
--- /dev/null
+++ b/trunk/workspace/gcb/mega1284-Eprom_Programmer.gcb
@@ -0,0 +1,73 @@
+' ########### start ###########
+' avr:mega1284
+' ########### end ###########
+'
+' ******************************************************************
+' EPROM Emulator with ATMega1284(p)
+' 2016-08-23 (c) Paolo Iocco
+' ******************************************************************
+'
+' Circuit diagram
+' ATmega 1284 Pin map
+' +-\/-+
+' A08--PB0--1|o |40--PA0--A00
+' A09--PB1--2| |39--PA1--A01
+' A10--PB2--3| |38--PA2--A02
+' A11--PB3--4| |37--PA3--A03
+' A12--PB4--5| |36--PA4--A04
+' MOSI---(A13)-PB5--6| |35--PA5--A05
+' MISO---(A14)-PB6--7| |34--PA6--A06
+' SCK----(A15)-PB7--8| |33--PA7--A07
+' /Reset 9| |32 AREF
+' VCC 10| |31 GND
+' GND 11| |30 AVCC
+' XTAL1 12| |29--PC7--D7
+' XTAL2 13| |28--PC6--D6
+' RXD0---------PD0-14| |27--PC5--D5
+' TXD0---------PD1-15| |26--PC4--D4
+' /E---PD2 16| |25--PC3--D3
+' /OE--PD3 17| |24--PC2--D2
+' CS2--PD4 18| |23--PC1--D1
+' /WE--PD5 19| |22--PC0--D0
+' GLCD_RESET---PD6 20| |21 PD7------GLCD_SCK
+' +----+
+' ******************************************************************
+' 9.6MHz:
+' LFuse: 0xxx; HFuse: 0xxx;
+' AVRDude: -U lfuse:w:0xxx:m -U hfuse:w:0xxx:m
+'
+' ******************************************************************
+
+#chip mega1284,16
+
+'#option explicit
+#define GLCD_TYPE GLCD_TYPE_PCD8544
+#include
+
+' Pin mapping
+#define GLCD_DO portb.5
+#define GLCD_SCK portd.7
+#define GLCD_DC portb.6
+#define GLCD_CS portb.7
+#define GLCD_RESET portd.6
+
+setup:
+Write_Command_PCD8544(0x21) 'Activate Chip and H=1.
+Write_Command_PCD8544(0xC2) 'Set LCD Voltage
+Write_Command_PCD8544(0x06) 'temperature correction
+Write_Command_PCD8544(0x13) 'set bias system
+Write_Command_PCD8544(0x20) 'set LCD mode:PDown=0, Vaddr=0, Hext=0
+Write_Command_PCD8544(0x09) 'Activate all segments.
+Clear_RAM_PCD8544() 'Erase all pixel on the DDRAM.
+Write_Command_PCD8544(0x08) 'Blank the Display.
+Write_Command_PCD8544(0x0C) 'Display Normal.
+GLCDCLS
+
+GLCDPrint(0, 0, "Done.")
+
+loop:
+DO forever
+
+LOOP
+
+end
diff --git a/trunk/workspace/gcb/mega168p-Paulino.gcb b/trunk/workspace/gcb/mega168p-Paulino.gcb
new file mode 100644
index 00000000..b1b8b0ae
--- /dev/null
+++ b/trunk/workspace/gcb/mega168p-Paulino.gcb
@@ -0,0 +1,113 @@
+' ########### start ###########
+' avr:mega168p
+' ########### end ###########
+'
+' ******************************************************************
+' Paulino 168p Microcontroller Board
+' 2016-06-30 (c) Paolo Iocco
+' ******************************************************************
+'
+' Circuit diagram
+' ---------------
+' ATtiny 88 / Mega 168 / Mega 328 Pin map
+' +-\/-+
+' +5V---| 100K |--->1|o |28 PC5 ADC5
+' RXD PD0 2| |27 PC4 ADC4
+' TXD PD1 3| |26 PC3 ADC3
+' PD2 4| |25 PC2 ADC2
+' GLCD_RESET<--PD3--5| |24 PC1 ADC1
+' GLCD_CS<-----PD4--6| |23 PC0 ADC0
+' VCC 7| |22 GND
+' GND 8| |21 AREF
+' OSC1------------->9| |20 VCC
+' OSC2------------>10| |19 PB5 SCK
+' GLCD_DC<-----PD5-11| |18 PB4 MISO
+' GLCD_DO<-----PD6-12| |17 PB3 OC2A MOSI
+' GLCD_SCK<----PD7-13| |16 PB2 OC1B
+' PB0 14| |15 PB1 OC1A
+' +----+
+' -------------------------------------------------------------
+' 16MHz:
+' LFuse: 0xxx; HFuse: 0xxx;
+' AVRDude: -U lfuse:w:0xxx:m -U hfuse:w:0xxx:m
+'
+' ******************************************************************
+
+#chip mega168p,16
+
+'#option explicit
+#define GLCD_TYPE GLCD_TYPE_PCD8544
+#include
+
+' Pin mapping
+#define GLCD_DO portd.6
+#define GLCD_SCK portd.7
+#define GLCD_DC portd.5
+#define GLCD_CS portd.4
+#define GLCD_RESET portd.3
+dim longNumber as long
+dim wordNumber as word
+dim byteNumber as byte
+dim indexvalue as byte
+dim CCount as byte
+dim temp as byte
+
+setup:
+longNumber=0
+wordNumber=0
+byteNumber=0
+Write_Command_PCD8544(0x21) 'Activate Chip and H=1.
+Write_Command_PCD8544(0xC2) 'Set LCD Voltage
+Write_Command_PCD8544(0x06) 'temperature correction
+Write_Command_PCD8544(0x13) 'set bias system
+Write_Command_PCD8544(0x20) 'set LCD mode:PDown=0, Vaddr=0, Hext=0
+Write_Command_PCD8544(0x09) 'Activate all segments.
+Clear_RAM_PCD8544() 'Erase all pixel on the DDRAM.
+Write_Command_PCD8544(0x08) 'Blank the Display.
+Write_Command_PCD8544(0x0C) 'Display Normal.
+GLCDCLS
+
+Table tabella as byte
+ 0x01, 0x02, 0x03, 0x04
+ 0x02, 0x03, 0x04, 0x05
+ 0x03, 0x04, 0x05, 0x06
+ 0x04, 0x05, 0x06, 0x07
+end Table
+
+loop:
+DO forever
+ for CCount = 31 to 127
+ indexvalue = CCount/16
+ readtable Tabella,indexvalue,temp
+ GLCDPrint(0, 0, "PrintStr")
+ GLCDDrawString(0, 9, "DrawStr")
+ GLCDPrint(44, 21, " ")
+ GLCDPrint(44, 29, " ") ' word value
+ GLCDPrint(44, 37, " ") ' Byte value
+ GLCDPrint(44, 21, hex(longNumber_U))
+ GLCDPrint(56, 21, hex(longNumber_H))
+ GLCDPrint(68, 21, hex(longNumber))
+ GLCDPrint(44, 29, mid( str(wordNumber),1, 6))
+ GLCDPrint(44, 37, byteNumber)
+
+ box 46,9,57,19
+ GLCDDrawChar(48, 9, CCount )
+ FilledBox(58,9,GLCD_WIDTH-1,17,GLCDBackground ) 'draw a box to overwrite existing strings
+ GLCDPrint(58, 9, str( CCount ))
+
+ box 0,0,GLCD_WIDTH-1, GLCD_HEIGHT-1
+ box GLCD_WIDTH-5, GLCD_HEIGHT-5,GLCD_WIDTH- 1, GLCD_HEIGHT-1
+
+ Circle( 25,30,8,1)
+ 'filledbox 2,30,6,38, wordNumber
+ 'FilledCircle( 25,30,4,longNumber xor 1)
+ 'line 0, GLCD_HEIGHT-1 , GLCD_WIDTH/2, (GLCD_HEIGHT /2) +1
+ 'line GLCD_WIDTH/2, (GLCD_HEIGHT /2) +1 ,0, (GLCD_HEIGHT /2) +1
+
+ longNumber = longNumber + 7
+ wordNumber = wordNumber + 3
+ byteNumber++
+ NEXT
+LOOP
+
+end
diff --git a/trunk/workspace/gcb/mega48v-blink.gcb b/trunk/workspace/gcb/mega48v-blink.gcb
new file mode 100644
index 00000000..89583e3c
--- /dev/null
+++ b/trunk/workspace/gcb/mega48v-blink.gcb
@@ -0,0 +1,56 @@
+' ########### start ###########
+' avr:mega48
+' ########### end ###########
+'
+' ******************************************************************
+' A program to flash LED on PORTB.0
+' 2018-03-07 (c) Paolo Iocco
+' ******************************************************************
+'
+' Circuit diagram
+' ---------------
+' ATtiny 48 / 88 / Mega 168 / Mega 328 Pin map
+' +-\/-+
+' +5V---| 100K |--->1|o |28 PC5 ADC5
+' RXD PD0 2| |27 PC4 ADC4
+' TXD PD1 3| |26 PC3 ADC3
+' PD2 4| |25 PC2 ADC2
+' PD3--5| |24 PC1 ADC1
+' PD4--6| |23 PC0 ADC0
+' VCC 7| |22 GND
+' GND 8| |21 AREF
+' OSC1------------->9| |20 VCC
+' OSC2------------>10| |19 PB5 SCK
+' PD5-11| |18 PB4 MISO
+' PD6-12| |17 PB3 OC2A MOSI
+' PD7-13| |16 PB2 OC1B
+' LED<----PB0 14| |15 PB1 OC1A
+' +----+
+' -------------------------------------------------------------
+' 8MHz internal: (http://www.engbedded.com/fusecalc/)
+' LFuse: 0xe2; HFuse: 0xdf;
+' avrdude -B 10 -c USBasp -p ATmega48 -U lfuse:w:0xe2:m -U hfuse:w:0xdf:m
+'
+' ******************************************************************
+
+#chip mega48,8
+
+#define led PORTD.0
+dir led out
+
+'Startup routine
+Startup:
+
+'Main routine
+Loop:
+ 'Turn one LED on, the other off
+ SET led ON
+ Wait 500 ms
+ 'Now toggle the LEDs
+
+ SET led OFF
+ Wait 500 ms
+'Jump back to the start of the program
+goto Loop
+
+end
diff --git a/trunk/workspace/gcb/mega48v-mouse.gcb b/trunk/workspace/gcb/mega48v-mouse.gcb
new file mode 100644
index 00000000..3c97ccfd
--- /dev/null
+++ b/trunk/workspace/gcb/mega48v-mouse.gcb
@@ -0,0 +1,405 @@
+' ########### start ###########
+' avr:mega48
+' ########### end ###########
+'
+' ******************************************************************
+' Mouse for ATARI and AMIGA
+' 2018-03-09 (c) Paolo Iocco
+' ******************************************************************
+'
+' Circuit diagram
+' ---------------
+' ATtiny 48 / 88 / Mega 168 / Mega 328 Pin map
+' +-\/-+
+' +5V---| 100K |--->1|o |28<-PC5-ADC5-----X_Pot
+' RxD>---------PD0--2| |27<-PC4-ADC4-----Y_Pot
+' TxD<---------PD1--3| |26 PC3 ADC3
+' LED<---------PD2--4| |25 PC2 ADC2
+' PS2-CLK------PD3--5| |24<-PC1-ADC1-----L_Fire
+' PS2-DAT------PD4--6| |23<-PC0-ADC0-----R_Fire
+' VCC 7| |22 GND
+' GND 8| |21 AREF
+' --9| |20 VCC
+' -10| |19 PB5 SCK
+' YB<----------PD5-11| |18 PB4 MISO
+' YA<----------PD6-12| |17 PB3 MOSI
+' XA<----------PD7-13| |16--PB2---------->RB
+' XB<----------PB0-14| |15--PB1---------->LB
+' +----+
+' -------------------------------------------------------------
+' 8MHz internal: (http://www.engbedded.com/fusecalc/)
+' LFuse: 0xe2; HFuse: 0xdf;
+' avrdude -B 10 -c USBasp -p ATmega48 -U lfuse:w:0xe2:m -U hfuse:w:0xdf:m
+'
+' ******************************************************************
+
+'----------------------------------------------------------------------
+'
+' DB9 STANDARDS
+' ~~~~~~~~~~~~~
+'
+' Atari ST AMIGA
+'
+' +---------> YB +---------> XB
+' | +-------> YA | +-------> YA
+' | | +-----> XA | | +-----> XA
+' | | | +---> XB | | | +---> YB
+' | | | | | | | |
+' _____________ _____________
+' 5 \ x o o o o / 1 5 \ x o o o o / 1
+' \ o o o o / \ o o o o /
+' 9 `~~~~~~~' 6 9 `~~~~~~~' 6
+' | | | | | | | |
+' | | | +----> Left Button | | | +----> Left Button
+' | | +------> Power | | +------> Power
+' | +--------> Ground | +--------> Ground
+' +----------> Right Button +----------> Right Button
+
+#chip mega48,8
+
+#define PS2Clock PORTD.3
+#define PS2Data PORTD.4
+#define led PORTD.2
+#define XB PORTB.0
+#define XA PORTD.7
+#define YA PORTD.6
+#define YB PORTD.5
+#define LB PORTB.1
+#define RB PORTB.2
+#define R_Fire PORTC.0
+#define L_Fire PORTC.1
+#define X_Pot PORTC.5
+#define Y_Pot PORTC.4
+#define bias_f 60 ' bias for analog read - fast
+#define bias_s 15 ' bias for analog read - slow
+#define pulse 500 us
+
+#define USART_BAUD_RATE 9600
+#define USART_BLOCKING
+#define PS2_DELAY 10 ms
+
+dir led out ' ON: mouse; OFF: joystick
+dir RB out
+dir LB out
+dir XA out
+dir YA out
+dir XB out
+dir XB out
+dir R_Fire in
+dir L_Fire in
+dir X_Pot in
+dir Y_Pot in
+DIR PS2Clock IN
+DIR PS2Data IN
+
+dim slow as byte
+
+'Startup routine
+Startup:
+set led on ' debug without mouse
+wait 1 s
+set led off
+wait 200 ms
+HSerPrint "Restarted"
+HSerPrintCRLF
+HSerPrintCRLF
+'goto Joystick
+
+MouseHandler:
+HSerPrint "Mouse"
+HSerPrintCRLF
+' *********************************************************************
+' * Mouse section
+' *********************************************************************
+set led on ' try with mouse
+'Try and Init Mouse
+'mouse = PS2ReadByte ' Self-test passed
+'if mouse <> 0xaa then goto Joystick
+'mouse = PS2ReadByte ' Mouse ID
+'if mouse <> 0x00 then goto Joystick
+
+PS2WriteByte 0xff ' Reset command
+mouse = PS2ReadByte ' Acknowledge
+'if mouse <> 0xfa then goto Joystick
+mouse = PS2ReadByte ' Self-test passed
+'if mouse <> 0xaa then goto Joystick
+mouse = PS2ReadByte ' Mouse ID
+'if mouse <> 0x00 then goto Joystick
+
+'PS2WriteByte 0xff ' Reset command
+'mouse = PS2ReadByte ' Acknowledge
+'if mouse <> 0xfa then goto Joystick
+'mouse = PS2ReadByte ' Self-test passed
+'if mouse <> 0xaa then goto Joystick
+'mouse = PS2ReadByte ' Mouse ID
+'if mouse <> 0x00 then goto Joystick
+
+PS2WriteByte 0xfa ' Enter Stream Mode
+mouse = PS2ReadByte ' Acknowledge
+'if mouse <> 0xfa then goto Joystick
+
+'Main Mouse routine
+Loop:
+do
+
+ ' ------------------------
+ ' D7 D6 D5 D4 D3 D2 D1 D0 (The D0 bit (LSB) is sent first)
+ ' ------------------------
+ '(1) YV XV YS XS 1 0 R L (overflow, sign, buttons)
+ '(2) X7 X6 X5 X4 X3 X2 X1 X0 (X movement; -128 to +127)
+ '(3) Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 (Y movement; -128 to +127)
+
+ 'L = Left Button State (1 = pressed down)
+ 'R = Right Button State (1 = pressed down)
+ 'XS = Direction of X movement (1 = LEFT)
+ 'YS = Direction of Y movement (1 = UP)
+ 'XV = Overflow of X movement value (1 = X overflow occured)
+ 'YV = Overflow of Y movement value (1 = Y overflow occured)
+ 'X7,...,X0 : X movement; 8-bit 2's-complement signed byte (-128 to +127)
+ 'Y7,...,Y0 : Y movement; 8-bit 2's-complement signed byte (-128 to +127)
+
+ 'Here are examples of data sent to the host (PC):
+ '------------------------------------------------
+ '(The least-significant bit of each data byte is sent first.)
+ 'Move Left 1 unit : 0x18, 0xFF, 0x00
+ 'Move Right 1 unit : 0x08, 0x01, 0x00
+ 'Move Down 1 unit : 0x28, 0x00, 0xFF
+ 'Move Up 1 unit : 0x08, 0x00, 0x01
+ 'Press Left Button : 0x09, 0x00, 0x00
+ 'Release Left Button : 0x08, 0x00, 0x00
+ 'Press Right Button : 0x0C, 0x00, 0x00
+ 'Release Right Button : 0x08, 0x00, 0x00
+
+ '13. Interpret the direction bits (explained in the Mouse Interface section)
+ '14. Interpret the X and Y motion bytes
+ '15. Update cumulative X,Y motion and display on LCD
+ '16. Repeat steps 1-15 indefinitely
+
+ mouse = PS2ReadByte
+ mouse_x = PS2ReadByte
+ mouse_y = PS2ReadByte
+
+ HSerPrint "CTL: "
+ HSerPrint mouse
+ HSerPrint "; X: "
+ HSerPrint mouse_x
+ HSerPrint "; Y: "
+ HSerPrint mouse_y
+ HSerPrintCRLF
+
+ if mouse.0 then
+ gosub LeftButtonON
+ else
+ gosub LeftButtonOFF
+ end if
+
+ if mouse.1 then
+ gosub RightButtonON
+ else
+ gosub RightButtonOFF
+ end if
+
+ if mouse.2 then
+ gosub MidButtonON
+ else
+ gosub MidButtonOFF
+ end if
+
+ if mouse_x <> 0 then gosub MMove_x
+ if mouse_y <> 0 then gosub MMove_y
+
+loop
+
+LeftButtonON:
+ set LB off
+ return
+LeftButtonOFF:
+ set LB on
+ return
+
+RightButtonON:
+ set RB off
+ return
+RightButtonOFF:
+ set RB on
+ return
+
+MidButtonON:
+ 'set MB off
+ return
+MidButtonOFF:
+ 'set MB on
+ return
+
+MMove_x:
+ if mouse.4 then
+ set XA on
+ wait 1 ms
+ set XB on
+ wait 1 ms
+ set XA off
+ wait 1 ms
+ set XB off
+ wait 1 ms
+ else
+ set XB on
+ wait 1 ms
+ set XA on
+ wait 1 ms
+ set XB off
+ wait 1 ms
+ set XA off
+ wait 1 ms
+ end if
+ return
+
+MMove_y:
+ if mouse.5 then
+ set YA on
+ wait 1 ms
+ set YB on
+ wait 1 ms
+ set YA off
+ wait 1 ms
+ set YB off
+ wait 1 ms
+ else
+ set YB on
+ wait 1 ms
+ set YA on
+ wait 1 ms
+ set YB off
+ wait 1 ms
+ set YA off
+ wait 1 ms
+ end if
+ return
+
+' *********************************************************************
+' * Joystick section
+' *********************************************************************
+Joystick:
+HSerPrint "Joystick"
+HSerPrintCRLF
+' read zero positions
+zero_x = ReadAD(ADC5)
+zero_y = ReadAD(ADC4)
+' do main loop
+do
+ ' ** buttons **
+ LeftButton(L_Fire)
+ RightButton(R_Fire)
+
+ ' ** movement **
+ X_Pos = ReadAD(ADC5)
+ Y_Pos = ReadAD(ADC4)
+
+ slow=0
+ if X_Pos < (zero_x - bias_f) then Move_x (0)
+ if (X_Pos >= (zero_x - bias_f)) and (X_Pos < (zero_x - bias_s)) then
+ Move_x (0)
+ slow=1
+ end if
+ if (X_Pos > (zero_x + bias_s)) and (X_Pos <= (zero_x + bias_f)) then
+ Move_x (1)
+ slow=1
+ end if
+ if X_Pos > (zero_x + bias_f) then Move_x (1)
+
+ if Y_Pos < (zero_y - bias_f) then Move_y (0)
+ if (Y_Pos >= (zero_y - bias_f)) and (Y_Pos < (zero_y - bias_s)) then
+ Move_y (0)
+ slow=1
+ end if
+ if (Y_Pos > (zero_y + bias_s)) and (Y_Pos <= (zero_y + bias_f)) then
+ Move_y (1)
+ slow=1
+ end if
+ if Y_Pos > (zero_y + bias_f) then Move_y (1)
+
+
+ 'ACK Blink
+ SET led ON
+ Wait 10 us
+ SET led OFF
+ if slow=1 then
+ wait 40 ms
+ else
+ wait 100 us
+ end if
+
+Loop
+
+' *********************************************************************
+' * Common sub section
+' *********************************************************************
+
+sub LeftButton(in status)
+ 'if status then
+ ' set LB off
+ 'else
+ ' set LB on
+ 'end if
+ SetWith( LB, status )
+ wait 1 ms
+end sub
+
+sub RightButton(in status)
+ 'if status then
+ ' set RB off
+ 'else
+ ' set RB on
+ 'end if
+ SetWith( RB, status )
+ wait 1 ms
+end sub
+
+' ***********************
+' generate the x movement
+sub Move_x(in direction)
+ if direction then
+ set XA on
+ wait pulse
+ set XB on
+ wait pulse
+ set XA off
+ wait pulse
+ set XB off
+ wait pulse
+ else
+ set XB on
+ wait pulse
+ set XA on
+ wait pulse
+ set XB off
+ wait pulse
+ set XA off
+ wait pulse
+ end if
+end sub
+
+' ***********************
+' generate the y movement
+sub Move_y(in direction)
+ if direction then
+ set YA on
+ wait pulse
+ set YB on
+ wait pulse
+ set YA off
+ wait pulse
+ set YB off
+ wait pulse
+ else
+ set YB on
+ wait pulse
+ set YA on
+ wait pulse
+ set YB off
+ wait pulse
+ set YA off
+ wait pulse
+ end if
+end sub
+
+end
diff --git a/trunk/workspace/gcb/morse_code.gcb b/trunk/workspace/gcb/morse_code.gcb
new file mode 100644
index 00000000..5bd7c5f7
--- /dev/null
+++ b/trunk/workspace/gcb/morse_code.gcb
@@ -0,0 +1,156 @@
+' ########### start ###########
+' pic:PIC16F877A
+' ########### end ###########
+
+'Morse Code demonstration for Great Cow BASIC
+'(c) Hugh Considine 2006
+
+'A program to accept messages from a standard PS/2 keyboard, then play
+'them as morse code using a speaker.
+
+'User Settings
+#define CodeFrequency 750 'Hz
+#define DotLength 5 '* 10 ms
+#define DotSpace 25 '* 10 ms
+#define BarLength 25 '* 10 ms
+#define BarSpace 5 '* 10 ms
+
+'Hardware settings
+#chip 16F877A, 20
+#mem 368
+
+'LCD connection settings
+#define LCD_IO 8
+#define LCD_DATA_PORT PORTC
+#define LCD_RS PORTD.0
+#define LCD_RW PORTD.1
+#define LCD_Enable PORTD.2
+
+'PS/2 keyboard connection settings
+#define PS2Clock PORTB.1
+#define PS2Data PORTB.2
+
+'Tone output pin
+#define SoundOut PORTD.3
+
+'Set port directions
+DIR PS2Clock IN
+DIR PS2Data IN
+DIR SoundOut OUT
+
+'Clear key buffer
+DIM KeyLog(32)
+DataCount = 0
+KeyLog(1) = 32 'Space character
+
+'Show opening message
+PRINT "GCBASIC Morse"
+locate 1,0
+PRINT "Code Transmitter"
+
+'Main routine
+Main:
+
+ 'Get a keypress
+ KeyIn = INKEY
+ if KeyIn = 0 then goto Main
+
+ 'Allow time for key to be released
+ wait 150 ms
+
+ 'if ENTER is pressed, then send message
+ if KeyIn = 13 then
+ MorseSend
+ goto Main
+ end if
+
+ 'Escape - clear message buffer
+ if KeyIn = 27 then
+ DataCount = 0
+ for DataPos = 1 to 32
+ KeyLog(DataPos) = 32
+ next
+ goto DisplayData
+ end if
+
+ 'Backspace - delete last character
+ if KeyIn = 8 then
+ if DataCount = 0 then goto Main
+ KeyLog(DataCount) = 32
+ DataCount = DataCount - 1
+ goto DisplayData
+ end if
+
+ 'Otherwise, add the character to the buffer
+ DataCount = DataCount + 1
+ KeyLog(DataCount) = KeyIn
+
+DisplayData:
+ 'Display key log
+ CLS
+ for DataPos = 1 to DataCount
+ if DataPos = 17 then locate 1,0
+ LCDWriteChar KeyLog(DataPos)
+ next
+
+goto Main
+
+sub MorseSend
+ for SendLetter = 1 to DataCount
+ Letter = KeyLog(SendLetter)
+
+ 'Numbers
+ if Letter = 48 then Bar: Bar: Bar: Bar: Bar '0
+ if Letter = 49 then Dot: Bar: Bar: Bar: Bar '1
+ if Letter = 50 then Dot: Dot: Bar: Bar: Bar '2
+ if Letter = 51 then Dot: Dot: Dot: Bar: Bar '3
+ if Letter = 52 then Dot: Dot: Dot: Dot: Bar '4
+ if Letter = 53 then Dot: Dot: Dot: Dot: Dot '5
+ if Letter = 54 then Bar: Dot: Dot: Dot: Dot '6
+ if Letter = 55 then Bar: Bar: Dot: Dot: Dot '7
+ if Letter = 56 then Bar: Bar: Bar: Dot: Dot '8
+ if Letter = 57 then Bar: Bar: Bar: Bar: Dot '9
+
+ 'Letters
+ if Letter >= 97 and Letter <= 122 then Letter -= 32 'Convert to upper case
+ if Letter = 65 then Dot: Bar
+ if Letter = 66 then Bar: Dot: Dot: Dot
+ if Letter = 67 then Bar: Dot: Bar: Dot
+ if Letter = 68 then Bar: Dot: Dot
+ if Letter = 69 then Dot
+ if Letter = 70 then Dot: Dot: Bar: Dot
+ if Letter = 71 then Bar: Bar: Dot
+ if Letter = 72 then Dot: Dot: Dot: Dot
+ if Letter = 73 then Dot: Dot 'I
+ if Letter = 74 then Dot: Bar: Bar: Bar 'J
+ if Letter = 75 then Bar: Dot: Bar 'K
+ if Letter = 76 then Dot: Bar: Dot: Dot 'L
+ if Letter = 77 then Bar: Bar 'M
+ if Letter = 78 then Bar: Dot 'N
+ if Letter = 79 then Bar: Bar: Bar 'O
+ if Letter = 80 then Dot: Bar: Bar: Dot 'P
+ if Letter = 81 then Bar: Bar: Dot: Bar 'Q
+ if Letter = 82 then Dot: Bar: Dot 'R
+ if Letter = 83 then Dot: Dot: Dot 'S
+ if Letter = 84 then Bar 'T
+ if Letter = 85 then Dot: Dot: Bar 'U
+ if Letter = 86 then Dot: Dot: Dot: Bar 'V
+ if Letter = 87 then Dot: Bar: Bar 'W
+ if Letter = 88 then Bar: Dot: Dot: Bar 'X
+ if Letter = 89 then Bar: Dot: Bar: Bar 'Y
+ if Letter = 90 then Bar: Bar: Dot: Dot 'Z
+
+ 'Misc
+ if Letter = 32 then wait 30 10ms 'Space
+ next
+end sub
+
+sub Dot
+ Tone CodeFrequency, DotLength
+ wait DotSpace 10ms
+end sub
+
+sub Bar
+ Tone CodeFrequency, BarLength
+ wait BarSpace 10ms
+end sub
\ No newline at end of file
diff --git a/trunk/workspace/gcb/pic18_pin.h b/trunk/workspace/gcb/pic18_pin.h
new file mode 100644
index 00000000..15a3f36e
--- /dev/null
+++ b/trunk/workspace/gcb/pic18_pin.h
@@ -0,0 +1,38 @@
+'paulino.h
+'paulino18 I/O Header File
+'
+' Circuit diagram
+' ---------------
+' +--\/--+
+' A2/D0 -----|1° 18|----- D12/A1
+' A3/D1 -----|2 17|----- D11/A0
+' A4/D2 -----|3 16|<---------H
+' RST ---->|4 15|<---------H = 4 MHz chrystal+ capacitors
+' GND ---->|5 14|<--------+5V
+' D3 -----|6 13|----- D10
+' D4 -----|7 12|----- D9
+' D5 -----|8 11|----- D8
+' D6 -----|9 10|----- D7
+' +------+
+
+#define D0 porta.2
+#define D1 porta.3
+#define D2 porta.4
+#define D3 portb.0
+#define D4 portb.1
+#define D5 portb.2
+#define D6 portb.3
+#define D7 portb.4
+#define D8 portb.5
+#define D9 portb.6
+#define D10 portb.7
+#define D11 porta.0
+#define D12 porta.1
+
+#define A0 porta.0
+#define A1 porta.1
+#define A2 porta.2
+#define A3 porta.3
+#define A4 porta.4
+
+
diff --git a/trunk/workspace/gcb/pic6_pin.h b/trunk/workspace/gcb/pic6_pin.h
new file mode 100644
index 00000000..a88d946a
--- /dev/null
+++ b/trunk/workspace/gcb/pic6_pin.h
@@ -0,0 +1,20 @@
+'paulino.h
+'paulino6 I/O Header File
+'
+' Circuit diagram
+' ---------------
+' +--\/--+
+' A0/D0/PGD -----|1° 6|----- D3/RES/VPP
+' GND ---------->|2 5|<------- +5V
+' A1/D1/PGC -----|3 4|----- D2
+' +------+
+
+#define D0 GPIO.0
+#define D1 GPIO.1
+#define D2 GPIO.2
+#define D3 GPIO.3
+
+#define A0 GPIO.0
+#define A1 GPIO.1
+
+
diff --git a/trunk/workspace/gcb/pic8_pin.h b/trunk/workspace/gcb/pic8_pin.h
new file mode 100644
index 00000000..e77677de
--- /dev/null
+++ b/trunk/workspace/gcb/pic8_pin.h
@@ -0,0 +1,25 @@
+'paulino.h
+'paulino18 I/O Header File
+'
+' Circuit diagram
+' ---------------
+' +--\/--+
+' +5V ------>|1 8|<-------GND
+' D0 -----|2 7|----- D5/A0
+' A3/D1 -----|3 6|----- D4/A1
+' D2 -----|4 5|----- D3/A2
+' +------+
+
+#define D0 GPIO.5
+#define D1 GPIO.4
+#define D2 GPIO.3
+#define D3 GPIO.2
+#define D4 GPIO.1
+#define D5 GPIO.0
+
+#define A0 GPIO.0
+#define A1 GPIO.1
+#define A2 GPIO.2
+#define A3 GPIO.4
+
+
diff --git a/trunk/workspace/gcb/pot_servo.gcb b/trunk/workspace/gcb/pot_servo.gcb
new file mode 100644
index 00000000..a33b26d6
--- /dev/null
+++ b/trunk/workspace/gcb/pot_servo.gcb
@@ -0,0 +1,24 @@
+' ########### start ###########
+' pic:PIC16F886
+' ########### end ###########
+
+'pot_servo.gcb
+'This program reads the potentiometer on AN0 and drives
+'a small servo motor to a position based on the potentiometer
+'position. Servo is connected to D8 (PORTB.0)
+
+'Chip model
+#chip 16f886, 16
+
+main:
+count = ReadAD(AN0)
+if count < 75 then
+ count = 75 'Limit CW travel
+end if
+if count > 225 then
+ count = 225 'Limit CCW travel
+end if
+PulseOut D8,count 10us
+Wait 20 ms
+
+goto main
diff --git a/trunk/workspace/gcb/softpwm_dual_alternate.gcb b/trunk/workspace/gcb/softpwm_dual_alternate.gcb
new file mode 100644
index 00000000..e1939acc
--- /dev/null
+++ b/trunk/workspace/gcb/softpwm_dual_alternate.gcb
@@ -0,0 +1,30 @@
+' ########### start ###########
+' pic:PIC16F886
+' ########### end ###########
+
+'SoftPWM_dual_alternate.gcb
+'A program to brighten and dim the LEDs on Demo-Shield
+'Red LEDs on PIC13 and Pin 10 will alternate
+'Dimming and Brightening
+
+'Chip model
+#chip 16F886, 16
+#include ' Defines all the CHIPINO connections
+#define PWM_out1 D13 ' define the PWMout 1 pin.
+#define PWM_out2 D10 ' define the PWMout 1 pin.
+
+'Main routine
+Start:
+ 'Turn one LED on, the other off
+do
+for cnt = 10 to 250 step 10 'Change duty cycle brighter
+ PWMOut(1, cnt, 10) 'slowly get brighter, 100 value sets speed
+ PWMOut(2, 250-cnt, 10)
+next
+for cnt = 250 to 10 step -10 'change duty cycle dimmer
+ PWMOut (1, cnt, 10) 'slowly dim, 100 value sets speed
+ PWMOut (2, 250-cnt, 10)
+next
+ loop ' Continuous loop
+
+
diff --git a/trunk/workspace/gcb/softpwm_dual_together.gcb b/trunk/workspace/gcb/softpwm_dual_together.gcb
new file mode 100644
index 00000000..a7192626
--- /dev/null
+++ b/trunk/workspace/gcb/softpwm_dual_together.gcb
@@ -0,0 +1,29 @@
+' ########### start ###########
+' pic:PIC16F886
+' ########### end ###########
+
+'softPWM_dual_together.gcb
+'A program to brighten and dim the LEDs on Demo-Shield
+'Red LEDs on PIC13 and PIn 10 will DIM together and brighten together
+
+'Chip model
+#chip 16F886, 16
+#include ' Defines all the CHIPINO connections
+#define PWM_out1 D13 ' define the PWMout 1 pin.
+#define PWM_out2 D10 ' define the PWMout 1 pin.
+
+'Main routine
+Start:
+ 'Turn one LED on, the other off
+do
+for cnt = 10 to 250 step 10 'Change duty cycle brighter
+ PWMOut(1, cnt, 10) 'slowly get brighter, 100 value sets speed
+ PWMOut(2, cnt, 10)
+next
+for cnt = 250 to 10 step -10 'change duty cycle dimmer
+ PWMOut (1, cnt, 10) 'slowly dim, 100 value sets speed
+ PWMOut (2, cnt, 10)
+next
+ loop ' Continuous loop
+
+
diff --git a/trunk/workspace/gcb/softpwm_slow.gcb b/trunk/workspace/gcb/softpwm_slow.gcb
new file mode 100644
index 00000000..fcaeda86
--- /dev/null
+++ b/trunk/workspace/gcb/softpwm_slow.gcb
@@ -0,0 +1,25 @@
+' ########### start ###########
+' pic:PIC16F886
+' ########### end ###########
+
+'SoftPWM_slow.gcb
+'A program to brighten and dim the LED on PIN 13/PORTB5 slowly
+
+'Chip model
+#chip 16F886, 16
+'#include ' Defines all the CHIPINO connections
+#define PWM_out1 PORTA.0 ' define the PWMout 1 pin.
+
+'Main routine
+Start:
+ 'Turn one LED on, the other off
+do
+for cnt = 10 to 250 step 10 'Change duty cycle brighter
+ PWMOut(1, cnt, 100) 'slowly get brighter, 100 value sets spped
+next
+for cnt = 250 to 10 step -10 'change duty cycle dimmer
+ PWMOut (1, cnt, 100) 'slowly dim, 100 value sets speed
+next
+ loop ' Continuous loop
+
+
diff --git a/trunk/workspace/gcb/switch_dual.gcb b/trunk/workspace/gcb/switch_dual.gcb
new file mode 100644
index 00000000..cde2cc5b
--- /dev/null
+++ b/trunk/workspace/gcb/switch_dual.gcb
@@ -0,0 +1,29 @@
+' ########### start ###########
+' pic:PIC16F886
+' ########### end ###########
+
+'Switch_Dual.gcb
+'Monitor two switches and light LED when pressed.
+'Setup for Demo-Shield
+'D8 switch controls D10 LED
+'D9 switch control D13 LED
+
+;Chip Settings
+#chip 16F886,16
+#include
+DIR D8 in 'Set D8 switch pin to input
+DIR D9 in 'Set D9 switch pin to input
+DIR D10 out 'Set D10 LED pin to output
+DIR D13 out 'Set D13 LED pin to output
+
+Start:
+If D8=0 Then
+ set D10 on 'D10 LED on
+ Set D13 off 'D13 LED off
+End If
+If D9=0 Then
+ Set D13 on 'D13 LED on
+ set D10 off 'D10 LED off
+End If
+Goto Start
+
diff --git a/trunk/workspace/gcb/tiny13-StepperTester.gcb b/trunk/workspace/gcb/tiny13-StepperTester.gcb
new file mode 100644
index 00000000..861d00c5
--- /dev/null
+++ b/trunk/workspace/gcb/tiny13-StepperTester.gcb
@@ -0,0 +1,74 @@
+' ########### start ###########
+' avr:tiny13
+' ########### end ###########
+'
+' ******************************************************************
+' A program to test Stepper Motors with a motor Breakoutbox
+' 2017-12-19 (c) Paolo Iocco
+' ******************************************************************
+'
+' Circuit diagram
+' ---------------
+' ATtiny 13/45/85 Pin map
+' +--\/--+
+' +5V>--/100k/----Reset---|1° 8|---Vcc----------------<+5V
+' DIR (PB3)<--|2 7|<--TRIMMER (PB2/ADC1) SCK
+ ' STEP(PB4)<--|3 6| NC PB1 MISO
+' GND>--------------GND---|4 5|-->LED PB0 MOSI
+' +------+
+'
+' -------------------------------------------------------------
+' 9.6MHz:
+' LFuse: 0x7A; HFuse: 0x1F;
+' AVRDude: avrdude -B 10 -c USBasp -p attiny13 -U lfuse:w:0x7a:m -U hfuse:w:0x1f:m
+'
+' ******************************************************************
+
+' Chip model
+#chip tiny13, 9.6
+
+' pins & direction
+#define led PORTB.0
+#define direzione PORTB.3
+#define passo PORTB.4
+#define trimmer PORTB.2
+dir led out
+dir direzione out
+dir passo out
+dir trimmer in
+
+' variables
+dim valore as byte
+dim counter as byte
+
+'Startup routine
+Startup:
+valore=0
+counter=0
+
+'Main routine
+Loop:
+ valore=ReadAD(ADC1)
+ ' determinazione della posizione, calcolo della velocità e del senso di rotazione
+ select case valore
+ case <= 120
+ SET direzione OFF
+ counter=121-valore
+ case >= 135
+ SET direzione ON
+ counter=valore-134
+ case else
+ SET passo OFF
+ set direzione OFF
+ counter=0
+ end select
+
+ if counter>0 then
+ SET led ON
+ pulseout passo, counter ms
+ SET led OFF
+ wait counter ms
+ end if
+
+'Jump back to the start of the program
+goto Loop
diff --git a/trunk/workspace/gcb/tiny13-blink.gcb b/trunk/workspace/gcb/tiny13-blink.gcb
new file mode 100644
index 00000000..4ea2e6f9
--- /dev/null
+++ b/trunk/workspace/gcb/tiny13-blink.gcb
@@ -0,0 +1,45 @@
+' ########### start ###########
+' avr:tiny13
+' ########### end ###########
+'
+' ******************************************************************
+' A program to flash LED on PORTB.0
+' 2016-06-30 (c) Paolo Iocco
+' ******************************************************************
+'
+' Circuit diagram
+' ---------------
+' ATtiny 13/45/85 Pin map
+' +--\/--+
+' +5V>--/Reset ADC0 PB5---|1° 8|---Vcc----------------<+5V
+' ADC3 PB3 -|2 7|- PB2 ADC1 SCK
+' ADC2 PB4 -|3 6|- PB1 OC0B MISO AIN1
+' GND>--------------GND---|4 5|---PB0 OC0A MOSI AIN0->LED
+' +------+
+'
+' -------------------------------------------------------------
+' 9.6MHz:
+' LFuse: 0x7A; HFuse: 0x1F;
+' AVRDude: avrdude -B 10 -c USBasp -p attiny13 -U lfuse:w:0x7a:m -U hfuse:w:0x1f:m
+'
+' ******************************************************************
+
+' Chip model
+#chip tiny13, 9.6
+#define led PORTB.0
+dir led out
+
+'Startup routine
+Startup:
+
+'Main routine
+Loop:
+ 'Turn one LED on, the other off
+ SET led ON
+ Wait 100 ms
+ 'Now toggle the LEDs
+
+ SET led OFF
+ Wait 100 ms
+'Jump back to the start of the program
+goto Loop
diff --git a/trunk/workspace/gcb/tiny13-osc.gcb b/trunk/workspace/gcb/tiny13-osc.gcb
new file mode 100644
index 00000000..4b13aaa0
--- /dev/null
+++ b/trunk/workspace/gcb/tiny13-osc.gcb
@@ -0,0 +1,49 @@
+' ########### start ###########
+' avr:tiny13
+' ########### end ###########
+'
+' ******************************************************************
+' A program to oscillate a pin
+' 2022-03-08 (c) Paolo Iocco
+' ******************************************************************
+'
+' Circuit diagram
+' ---------------
+' ATtiny 13/45/85 Pin map
+' +--\/--+
+' +5V>--/Reset ADC0 PB5---|1° 8|---Vcc----------------<+5V
+' ADC3 PB3 -|2 7|- PB2 ADC1 SCK
+' ADC2 PB4 -|3 6|- PB1 OC0B MISO AIN1
+' GND>--------------GND---|4 5|---PB0 OC0A MOSI AIN0->LED
+' +------+
+'
+' -------------------------------------------------------------
+' 9.6MHz:
+' LFuse: 0x7A; HFuse: 0x1F;
+' AVRDude: avrdude -B 10 -c USBasp -p attiny13 -U lfuse:w:0x7a:m -U hfuse:w:0x1f:m
+'
+' ******************************************************************
+
+' Chip model
+#chip tiny13, 9.6
+#define q0 PORTB.3
+#define q1 PORTB.4
+dir q0 out
+dir q1 out
+
+'Startup routine
+Startup:
+
+'Main routine
+Loop:
+ 'Turn one output on, the other off
+ SET q0 ON
+ SET q1 OFF
+ Wait 33 ms
+ 'Now toggle the outputs
+
+ SET q0 OFF
+ SET q1 ON
+ Wait 33 ms
+'Jump back to the start of the program
+goto Loop
diff --git a/trunk/workspace/gcb/tiny2313a-blink.gcb b/trunk/workspace/gcb/tiny2313a-blink.gcb
new file mode 100644
index 00000000..71d1286c
--- /dev/null
+++ b/trunk/workspace/gcb/tiny2313a-blink.gcb
@@ -0,0 +1,50 @@
+' ########### start ###########
+' avr:tiny2313
+' ########### end ###########
+'
+' ******************************************************************
+' A program to flash LED on PORTB.0
+' 2016-06-30 (c) Paolo Iocco
+' ******************************************************************
+'
+' Circuit diagram
+' ---------------
+'
+' +-\/-+
+' /Reset PA2 1|o |20 Vcc
+' RXD PD0 2| |19 PB7 SCK
+' TXD PD1 3| |18 PB6 MISO
+' PA1 4| |17 PB5 MOSI
+' PA0 5| |16 PB4 OC1B
+' PD2 6| |15 PB3 OC1A
+' PD3 7| |14 PB2 OC0A
+' PD4 8| |13 PB1 AIN1
+' OC0B PD5 9| |12--PB0-AIN0---->LED
+' GND 10| |11 PD6
+' +----+
+'
+' -------------------------------------------------------------
+' 9.6MHz:
+' LFuse: 0xxx; HFuse: 0xxx;
+' AVRDude: -U lfuse:w:0xxx:m -U hfuse:w:0xxx:m
+'
+' ******************************************************************
+
+'Chip model
+#chip tiny2313a,8
+#define led PORTB.0
+
+Startup:
+
+'Main routine
+Loop:
+ 'Turn one LED on, the other off
+ SET led ON
+ wait 100 ms
+ 'Now toggle the LEDs
+
+ SET led OFF
+ wait 100 ms
+'Jump back to the start of the program
+goto Loop
+
diff --git a/trunk/workspace/gcb/tiny24-blink.gcb b/trunk/workspace/gcb/tiny24-blink.gcb
new file mode 100644
index 00000000..754b8c83
--- /dev/null
+++ b/trunk/workspace/gcb/tiny24-blink.gcb
@@ -0,0 +1,45 @@
+' ########### start ###########
+' avr:tiny24
+' ########### end ###########
+'
+' ******************************************************************
+' A program to flash LED on PORTA.4 (SCK)
+' 2016-06-30 (c) Paolo Iocco
+' ******************************************************************
+'
+' Circuit diagram
+' ---------------
+' +--\/--+
+' VCC-------->|1° 14|<--------GND
+' PB0-------->|2 13|<--------PA0
+' PB1-------->|3 12|<--------PA1
+' PB3/Reset-->|4 11|---------PA2
+' PB2---------|5 10|---------PA3
+' PA7---------|6 9|---------PA4 SCK
+' PA6 MOSI----|7 8|---------PA5 MISO
+' +-------+
+'
+' 8MHz, internal RC Oscillator
+' Fuses:
+' AVRDude: avrdude -B 10 -c USBasp -p attiny24 -U lfuse:w:0xe2:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m
+
+
+'Chip model
+#chip tiny24, 8
+#define led PORTA.4
+dir led out
+
+Startup:
+
+'Main routine
+Loop:
+ 'Turn one LED on, the other off
+ SET led ON
+ Wait 500 ms
+
+ 'Now toggle the LEDs
+ SET led OFF
+ Wait 500 ms
+
+'Jump back to the start of the program
+goto Loop
diff --git a/trunk/workspace/gcb/tiny44-blink.gcb b/trunk/workspace/gcb/tiny44-blink.gcb
new file mode 100644
index 00000000..bbab10b7
--- /dev/null
+++ b/trunk/workspace/gcb/tiny44-blink.gcb
@@ -0,0 +1,45 @@
+' ########### start ###########
+' avr:tiny44
+' ########### end ###########
+'
+' ******************************************************************
+' A program to flash LED on PORTA.4 (SCK)
+' 2016-06-30 (c) Paolo Iocco
+' ******************************************************************
+'
+' Circuit diagram
+' ---------------
+' +--\/--+
+' VCC-------->|1° 14|<--------GND
+' PB0-------->|2 13|<--------PA0
+' PB1-------->|3 12|<--------PA1
+' PB3/Reset-->|4 11|---------PA2
+' PB2---------|5 10|---------PA3
+' PA7---------|6 9|---------PA4 SCK
+' PA6 MOSI----|7 8|---------PA5 MISO
+' +-------+
+'
+' 8MHz, internal RC Oscillator
+' Fuses:
+' AVRDude: avrdude -B 10 -c USBasp -p attiny44 -U lfuse:w:0xe2:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m
+
+
+'Chip model
+#chip tiny44, 8
+#define led PORTA.4
+dir led out
+
+Startup:
+
+'Main routine
+Loop:
+ 'Turn one LED on, the other off
+ SET led ON
+ Wait 500 ms
+
+ 'Now toggle the LEDs
+ SET led OFF
+ Wait 500 ms
+
+'Jump back to the start of the program
+goto Loop
diff --git a/trunk/workspace/gcb/tiny45-blink.gcb b/trunk/workspace/gcb/tiny45-blink.gcb
new file mode 100644
index 00000000..f00edb5c
--- /dev/null
+++ b/trunk/workspace/gcb/tiny45-blink.gcb
@@ -0,0 +1,43 @@
+' ########### start ###########
+' avr:tiny45
+' ########### end ###########
+'
+' ******************************************************************
+' A program to flash LED on PORTB.0
+' 2016-06-30 (c) Paolo Iocco
+' ******************************************************************
+'
+' Circuit diagram
+' ---------------
+' ATtiny 13/45/85 Pin map
+' +--\/--+
+' +5V>--/Reset ADC0 PB5---|1° 8|---Vcc----------------<+5V
+' ADC3 PB3 -|2 7|- PB2 ADC1 SCK
+' ADC2 PB4 -|3 6|- PB1 OC0B MISO AIN1
+' GND>--------------GND---|4 5|---PB0 OC0A MOSI AIN0->LED
+' +------+
+'
+' -------------------------------------------------------------
+'
+' 8MHz, internal RC Oscillator
+' Fuses:
+' AVRDude: avrdude -B 10 -c USBasp -p attiny45 -U lfuse:w:0xe2:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m
+
+'Chip model
+#chip tiny45, 8
+#define led PORTB.0
+dir led out
+
+Startup:
+
+'Main routine
+Loop:
+ 'Turn one LED on, the other off
+ SET led ON
+ Wait 100 ms
+ 'Now toggle the LEDs
+
+ SET led OFF
+ Wait 100 ms
+'Jump back to the start of the program
+goto Loop
diff --git a/trunk/workspace/gcb/tiny84-blink.gcb b/trunk/workspace/gcb/tiny84-blink.gcb
new file mode 100644
index 00000000..33c0c039
--- /dev/null
+++ b/trunk/workspace/gcb/tiny84-blink.gcb
@@ -0,0 +1,45 @@
+' ########### start ###########
+' avr:tiny84
+' ########### end ###########
+'
+' ******************************************************************
+' A program to flash LED on PORTA.4 (SCK)
+' 2016-06-30 (c) Paolo Iocco
+' ******************************************************************
+'
+' Circuit diagram
+' ---------------
+' +--\/--+
+' VCC-------->|1° 14|<--------GND
+' PB0-------->|2 13|<--------PA0
+' PB1-------->|3 12|<--------PA1
+' PB3/Reset-->|4 11|---------PA2
+' PB2---------|5 10|---------PA3
+' PA7---------|6 9|---------PA4 SCK
+' PA6 MOSI----|7 8|---------PA5 MISO
+' +-------+
+'
+' 8MHz, internal RC Oscillator
+' Fuses:
+' AVRDude: avrdude -B 10 -c USBasp -p attiny84 -U lfuse:w:0xe2:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m
+
+
+'Chip model
+#chip tiny84, 1
+#define led PORTA.4
+dir led out
+
+Startup:
+
+'Main routine
+Loop:
+ 'Turn one LED on, the other off
+ SET led ON
+ Wait 500 ms
+
+ 'Now toggle the LEDs
+ SET led OFF
+ Wait 500 ms
+
+'Jump back to the start of the program
+goto Loop
diff --git a/trunk/workspace/gcb/tiny84-joystick.gcb b/trunk/workspace/gcb/tiny84-joystick.gcb
new file mode 100644
index 00000000..887c6322
--- /dev/null
+++ b/trunk/workspace/gcb/tiny84-joystick.gcb
@@ -0,0 +1,148 @@
+' ########### start ###########
+' avr:tiny84
+' ########### end ###########
+'
+' 8MHz, internal RC Oscillator
+' Fuses:
+' AVRDude: avrdude -B 10 -c USBasp -p attiny84 -U lfuse:w:0xe2:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m
+
+'----------------------------------------------------------------------
+' Joystick adapter Nintendo SNES to AMIGA
+' 2016-01-21 (c) Paolo Iocco
+'
+' Circuit diagram
+' ---------------
+' ATTiny84
+' VCC-------->| |<--------GND
+' PB0-------->| |<--------PA0
+' PB1-------->| |<--------PA1
+' PB3/Reset-->| |---------PA2
+' PB2---------| |---------PA3
+' PA7---------| |---------PA4 SCK
+' PA6 MOSI----| |---------PA5 MISO
+'
+' 16C84
+' PA2 -----| |----- PA1
+' PA3 -----| |----- PA0
+' PA4 -----| |<---------H
+' RST ------>| |<---------H
+' GND ------>| |<--------+5V
+' PB0 -----| |----- PB7
+' PB1 -----| |----- PB6
+' PB2 -----| |----- PB5
+' PB3 -----| |----- PB4
+'----------------------------------------------------------------------
+'
+' SNES STANDARDS
+' ~~~~~~~~~~~~~~
+'
+' Pinout for SNES gamepads and mice
+'
+' +-----------------------\
+' 7 | o o o o | x x o | 1
+' +-----------------------/
+' | | | | |
+' | | | | +-> Ground
+' | | | +------------> Data
+' | | +---------------> Latch
+' | +------------------> Clock
+' +---------------------> Power
+' ____
+'LATCH _| |_________________________________________________________
+' _______ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ___________
+'CLOCK |_||_||_||_||_||_||_||_||_||_||_||_||_||_||_|
+' ____ _________
+'DATA |B |Y |SI|SU|UP|DN|LE|RI|A |X |L |R |? |? |? |? |(16 bit)
+'
+'
+'----------------------------------------------------------------------
+'
+' DB9 STANDARDS
+' ~~~~~~~~~~~~~
+'
+' Atari MSX
+'
+' +-----------> Power
+' +---------> Right | +---------> Right
+' | +-------> Left | | +-------> Left
+' | | +-----> Down | | | +-----> Down
+' | | | +---> Up | | | | +---> Up
+' | | | | | | | | |
+' _____________ _____________
+' 5 \ x o o o o / 1 5 \ o o o o o / 1
+' \ x o o o / \ o o o o /
+' 9 `~~~~~~~' 6 9 `~~~~~~~' 6
+' | | | | | | |
+' | | +----> Button | | | +----> Button 1
+' | +------> Power | | +------> Button 2
+' +--------> Ground | +--------> Output 3
+' +----------> Ground
+'
+' Commodore AMIGA
+'
+' +---------> Right +---------> Right
+' | +-------> Left | +-------> Left
+' | | +-----> Down | | +-----> Down
+' | | | +---> Up | | | +---> Up
+' | | | | | | | |
+' _____________ _____________
+' 5 \ x o o o o / 1 5 \ x o o o o / 1
+' \ x o x o / \ o o o o /
+' 9 `~~~~~~~' 6 9 `~~~~~~~' 6
+' | | | | | |
+' | +----> Button | | | +----> Button 1
+' +--------> Ground | | +------> Power
+' | +--------> Ground
+' +----------> Button 2
+'----------------------------------------------------------------------
+'
+' Sony Playstation
+' ~~~~~~~~~~~~~~~~
+'
+' The PSX controller is supported by the gamecon.c. Pinout of the PSX
+' controller (compatible with DirectPadPro):
+'
+' +---------+---------+---------+
+' 9 | o o x | o o o | o x x | 1 parallel
+' \________|_________|________/ port pins
+' | | | | | |
+' | | | | | +--------> Clock --- (4)
+' | | | | +------------> Select --- (3)
+' | | | +---------------> Power --- (5-9)
+' | | +------------------> Ground --- (18-25)
+' | +-------------------------> Command --- (2)
+' +----------------------------> Data --- (one of 10,11,12,13,15)
+'
+'----------------------------------------------------------------------
+
+'Chip model
+#chip tiny84a, 8
+
+'I/O
+#define o_up PORTA.4
+#define o_dn PORTA.4
+#define o_le PORTA.4
+#define o_ri PORTA.4
+#define o_f1 PORTA.4
+#define o_f2 PORTA.4
+#define i_dat PORTA.3
+#define i_lat PORTA.3
+#define i_clk PORTA.3
+dir o_up out
+dir o_dn out
+dir o_le out
+dir o_ri out
+dir o_f1 out
+dir o_f2 out
+dir i_dat in
+dir i_lat in
+dir i_clk in
+
+
+Startup:
+
+'Main routine
+Loop:
+ Wait 100 ms
+'Jump back to the start of the program
+goto Loop
diff --git a/trunk/workspace/gcb/tiny85-blink.gcb b/trunk/workspace/gcb/tiny85-blink.gcb
new file mode 100644
index 00000000..238554c3
--- /dev/null
+++ b/trunk/workspace/gcb/tiny85-blink.gcb
@@ -0,0 +1,43 @@
+' ########### start ###########
+' avr:tiny85
+' ########### end ###########
+'
+' ******************************************************************
+' A program to flash LED on PORTB.0
+' 2016-06-30 (c) Paolo Iocco
+' ******************************************************************
+'
+' Circuit diagram
+' ---------------
+' ATtiny 13/45/85 Pin map
+' +--\/--+
+' +5V>--/Reset ADC0 PB5---|1° 8|---Vcc----------------<+5V
+' ADC3 PB3 -|2 7|- PB2 ADC1 SCK
+' ADC2 PB4 -|3 6|- PB1 OC0B MISO AIN1
+' GND>--------------GND---|4 5|---PB0 OC0A MOSI AIN0->LED
+' +------+
+'
+' -------------------------------------------------------------
+'
+' 8MHz, internal RC Oscillator
+' Fuses:
+' AVRDude: avrdude -B 10 -c USBasp -p attiny85 -U lfuse:w:0xe2:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m
+
+'Chip model
+#chip tiny85, 8
+#define led PORTB.0
+dir led out
+
+Startup:
+
+'Main routine
+Loop:
+ 'Turn one LED on, the other off
+ SET led ON
+ Wait 100 ms
+ 'Now toggle the LEDs
+
+ SET led OFF
+ Wait 100 ms
+'Jump back to the start of the program
+goto Loop
diff --git a/trunk/workspace/gcb/tiny88-blink.gcb b/trunk/workspace/gcb/tiny88-blink.gcb
new file mode 100644
index 00000000..0c3a16c6
--- /dev/null
+++ b/trunk/workspace/gcb/tiny88-blink.gcb
@@ -0,0 +1,52 @@
+' ########### start ###########
+' avr:tiny88
+' ########### end ###########
+'
+' ******************************************************************
+' A program to flash LED on PORTC.0
+' 2016-06-30 (c) Paolo Iocco
+' ******************************************************************
+'
+' Circuit diagram
+' ---------------
+' ATtiny 88 / Mega 168 / Mega 328 Pin map
+' +-\/-+
+' /Reset 1|o |28 PC5 ADC5
+' RXD PD0 2| |27 PC4 ADC4
+' TXD PD1 3| |26 PC3 ADC3
+' PD2 4| |25 PC2 ADC2
+' PD3 5| |24 PC1 ADC1
+' PD4 6| |23--PC0-ADC0----->LED
+' VCC 7| |22 GND
+' GND 8| |21 AREF
+' OSC1------------->9| |20 VCC
+' OSC2------------>10| |19 PB5 SCK
+' PD5 11| |18 PB4 MISO
+' PD6 12| |17 PB3 OC2A MOSI
+' PD7 13| |16 PB2 OC1B
+' PB0 14| |15 PB1 OC1A
+' +----+
+' -------------------------------------------------------------
+'
+' 8MHz, internal RC Oscillator
+' Fuses:
+' AVRDude: avrdude -B 10 -c USBasp -p attiny88 -U lfuse:w:0xee:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m
+
+'Chip model
+#chip tiny88, 8
+#define led PORTC.0
+
+Startup:
+
+'Main routine
+Loop:
+ 'Turn one LED on, the other off
+ SET led ON
+ Wait 500 ms
+
+ 'Now toggle the LEDs
+ SET led OFF
+ Wait 500 ms
+
+'Jump back to the start of the program
+goto Loop
diff --git a/trunk/workspace/gcb/tone.gcb b/trunk/workspace/gcb/tone.gcb
new file mode 100644
index 00000000..6d9d88b9
--- /dev/null
+++ b/trunk/workspace/gcb/tone.gcb
@@ -0,0 +1,16 @@
+' ########### start ###########
+' pic:PIC16F886
+' ########### end ###########
+
+'Tone.gcb
+'This program produces a constant A note (440 Hz)
+'on Digital Pin 5 connected to Piezo speaker on Demo-Shield
+
+#chip 16F886, 16
+#include
+
+#define SoundOut D5
+
+Do
+ Tone 440, 1000
+Loop