Electromag1 Circuits électroniques et Picaxes

Petit site pour ceux qui bricolent en électronique en général et sur les PICAXES en particulier.
Les PICAXES sont des microprocesseurs (PIC de Microship) programmables en BASIC. Pleins de qualités, pas chers, ultra faciles à programmer.
Tout (ou presque) est sur le site du distributeur Gotronic (voir les liens).
Les pages  seront ajoutées ou modifiées petit à petit.
Dans le but d'améliorer ce blog, communiquez moi vos remarques et les erreurs que vous pouvez constater.
Pour me contacter: Envoyez un mail à l'adresse : mag1mic@free.fr .  Tout message reçoit une réponse
Pour retourner au menu, Cliquer sur "LISTE DES PAGES", ici ou en haut de la colonne de gauche
Pour laisser un message, allez dans le "LIVRE D'OR"
Bonne visite
 
 
 

LES AFFICHEURS
SH1106 et SH1107


 


Tout ce qui suit est le travail d'Anubis1985, édité sur le forum picaxe français: voici le lien vers cette page.
Les picaxes ne sont pas très forts en math, et faire des formes géométriques n'est possible qu'avec la série  X2, ici un picaxe 20X2.
Ces afficheurs ne contiennent aucune table de caractères en mémoire (comme un LCD2004 par ex) et la desription de l'ensemble des caractères d'un clavier occupe beaucoup de place. On peut heureusement se limiter aux caractères utiles à l'application ou lui adjoindre une mémoire annexe.
Voici le programme qu'il propose:
 
'Anubis1985 22-11-2025
'SH1107
'#picaxe 20X2
'#picaxe 28X2
'setfreq M64
'setfreq em64

Symbol L_graphiqueLCD  = b0
Symbol R_graphiqueLCD  = b1
Symbol NumASCII        = b2
Symbol LongeurNumASCII = b3
Symbol Contraste       = b4
Symbol OffsetX         = b5
Symbol NewContraste    = b6      
Symbol ColumHighBits   = b7
Symbol ColumLowBits    = b8
Symbol LongeurRF       = b9
Symbol Page            = b10
Symbol X               = b11
Symbol Y               = b12
Symbol BitsTempon      = b13
Symbol ClearPixel      = b14
Symbol ClearY          = b15
Symbol Print           = b16
Symbol stipple         = b17
Symbol x0              = b18
Symbol x1              = b19
Symbol y0              = b20
Symbol y1              = b21
Symbol AngleY          = b22
Symbol AngleX          = b23
Symbol X_Neatif        = b24
Symbol Y_Neatif        = b25
Symbol AngleX1         = w13
Symbol BP_0   = Pinc.0 'Oriantation de l'affichage 'contacte a bille
Symbol LedRouge = B.1
Symbol LedVert  = B.2
Symbol LedBleu  = B.3
Symbol LedJauneA = B.4
Symbol LedJauneB = B.6

'Commande du controleur SH1107
Symbol SETCONTRAST =0x81
Symbol DISPLAYALLON =0xA5
Symbol DISPLAYOFF =0xAE
Symbol DISPLAYON =0xAF
Symbol SETDISPLAYOFFSET =0xD3
Symbol SETMULTIPLEX =0xA8
Symbol SETLOWCOLUMN =0x00
Symbol SetColumHighBits = 0x10
Symbol SETSTARTLINE =0x40
Symbol CHARGEPUMP =0x8D
'Display scrolling commands
'Symbol ACTIVATE_SCROLL =0x2F
'Symbol DEACTIVATE_SCROLL =0x2E
'Symbol SET_VERTICAL_SCROLL_AREA =0xA3
'Symbol HORIZONTAL_SCROLL_RIGHT =0x26
'Symbol HORIZONTAL_SCROLL_LEFT =0x27
'Symbol VERT_AND_RIGHT_HORIZONTAL =0x29
'Symbol VERT_AND_LEFT_HORIZONTAL =0x2A
ColumLowBits  = 0
ColumHighBits = 0
setfreq M64
pause 400'50ms a 64mhz
hi2csetup i2cmaster, %01111000, i2cfast_64, I2cbyte

'hi2cout (0,ACTIVATE_SCROLL)'deplacement progerssif affichage de gauche a doite par defaut
'hi2cout (0,HORIZONTAL_SCROLL_RIGHT)'deplacement progerssif affichage de gauche a doite
'hi2cout (0,HORIZONTAL_SCROLL_LEFT)'deplacement progerssif affichage de droite a gauche
'hi2cout (0,VERT_AND_RIGHT_HORIZONTAL)
gosub ClearDisplay
StarCode:
         gosub ContrasteADJ
     'gosub DISPLAY_OFF   'Etain L'Ecrant
      'gosub DISPLAY_ON    'Allume L'Ecrant
     'gosub ClearDisplay  'Efface L'Ecrant complet
      'gosub ClearPage    'Efface Une ligne complete
      'gosub InversDisplay '
      'gosub NormalDisplay '
      'gosub SensPixelConfigMiroir'Ecri a l'Enver
         gosub SensPixelConfigInitial'Ecri a l'Endroi
      'OffsetX = 1 : gosub OffsetMod'Mini 0 Maxi 127
      
   x1 = 127'x_DimensionDuRectangleEnPixel
    y1 = 127'y_DimensionDuRectangleEnPixel
    x0 = 0  'x_CordonnerDepartEnPixel
    y0 = 0  'y_CordonnerDepartEnPixel
    stipple = 0
    ClearPixel = 0
    gosub DrawsRectangle'dessine un rectangle
   
   x1 = 63'x_DimensionDuCercleEnPixel
    y1 = 63'y_DimensionDuCercleEnPixel
    x0 = 63'x_CordonnerDepartEnPixel
   y0 = 63'y_CordonnerDepartEnPixel
    stipple = 1
    ClearPixel = 0
    gosub DrawsCircle'dessine un cercle
   
      x = 42 : gosub SetPosition
      LongeurNumASCII = 0
      Teste:
      lookup LongeurNumASCII,(2,"SH1107"), NumASCII
      gosub Numero
      inc LongeurNumASCII
      if  LongeurNumASCII < 7 then : gosub Teste endif 
                 
    x1      = 58'x_LongeurDeLaLigneEnPixel
    AngleX1 = 175'AngleDeLaLigneEndegres ( mini0 maxi 360)
    x0      = 63'x_CordonnerDepartEnPixel
    y0      = 63'y_CordonnerDepartEnPixel
    stipple = 0
    ClearPixel = 0
    gosub DrawsLine  'dessine une ligne
              
    x1      = 29'x_LongeurDeLaLigneEnPixel
    AngleX1 = 85'AngleDeLaLigneEndegres ( mini0 maxi 360)
    x0      = 63'x_CordonnerDepartEnPixel
    y0      = 63'y_CordonnerDepartEnPixel
    stipple = 0
    ClearPixel = 0
    gosub DrawsLine  'dessine une ligne         
                
goto StarCode 

ContrasteADJ:
      NewContraste = Contraste
      readadc  8, Contraste
    if Contraste <  10 then : Contraste =  10 : high LedJauneA else : low LedJauneA endif
      if Contraste > 250 then : Contraste = 250 : high LedJauneB else : low LedJauneB endif
      if NewContraste <> Contraste then : gosub ContrasteMode endif
return

Numero:
      select case NumASCII
    case 0 to 15 : Page = NumASCII + 176 : hi2cout (0,Page)'Page0 a Page15
    case 32  : hi2cout (SETSTARTLINE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,0x00) ;Espace
    case 33  : hi2cout (SETSTARTLINE, 0x00, 0x00, 0x5F, 0x00, 0x00)             ;!
    case 34  : hi2cout (SETSTARTLINE, 0x00, 0x00, 0x07, 0x00, 0x07, 0x00 ,0x00) ;"
    case 35  : hi2cout (SETSTARTLINE, 0x00, 0x14, 0x7F, 0x14, 0x7F, 0x14 ,0x00) ;#
    case 36  : hi2cout (SETSTARTLINE, 0x00, 0x24, 0x2a, 0x7f, 0x2a, 0x12 ,0x00) ;$
    case 37  : hi2cout (SETSTARTLINE, 0x00, 0x23, 0x13, 0x08, 0x64, 0x62 ,0x00) ;%
    case 38  : hi2cout (SETSTARTLINE, 0x00, 0x36, 0x49, 0x55, 0x22, 0x50 ,0x00) ;&
    case 39  : hi2cout (SETSTARTLINE, 0x00, 0X05, 0X03, 0X00, 0X00)             ;'
    case 40  : hi2cout (SETSTARTLINE, 0x00, 0X00, 0X1c, 0X22, 0X41, 0X00 ,0x00) ;(
    case 41  : hi2cout (SETSTARTLINE, 0x00, 0x00, 0x41, 0x22, 0x1c, 0x00 ,0x00) ;)
    case 42  : hi2cout (SETSTARTLINE, 0x00, 0x14, 0x08, 0x3E, 0x08, 0x14 ,0x00) ;*
    case 43  : hi2cout (SETSTARTLINE, 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08 ,0x00) ;+
    case 44  : hi2cout (SETSTARTLINE, 0x00, 0x00, 0x50, 0x30, 0x00 ,0x00)       ;,
    case 45  : hi2cout (SETSTARTLINE, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08 ,0x00) ;-
    case 46  : hi2cout (SETSTARTLINE, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00)       ;.
    case 47  : hi2cout (SETSTARTLINE, 0x00, 0x20, 0x10, 0x08, 0x04, 0x02 ,0x00) ;/
    case 48  : hi2cout (SETSTARTLINE, 0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E ,0x00) ;0
    case 49  : hi2cout (SETSTARTLINE, 0x00, 0x00, 0x42, 0x7F, 0x40, 0x00 ,0x00) ;1
    case 50  : hi2cout (SETSTARTLINE, 0x00, 0x72, 0x49, 0x49, 0x49, 0x46 ,0x00) ;2
    case 51  : hi2cout (SETSTARTLINE, 0x00, 0x21, 0x41, 0x49, 0x4D, 0x33 ,0x00) ;3
    case 52  : hi2cout (SETSTARTLINE, 0x00, 0x18, 0x14, 0x12, 0x7F, 0x10 ,0x00) ;4
    case 53  : hi2cout (SETSTARTLINE, 0x00, 0x27, 0x45, 0x45, 0x45, 0x39 ,0x00) ;5
    case 54  : hi2cout (SETSTARTLINE, 0x00, 0x3C, 0x4A, 0x49, 0x49, 0x31 ,0x00) ;6
    case 55  : hi2cout (SETSTARTLINE, 0x00, 0x41, 0x21, 0x11, 0x09, 0x07 ,0x00) ;7
    case 56  : hi2cout (SETSTARTLINE, 0x00, 0x36, 0x49, 0x49, 0x49, 0x36 ,0x00) ;8
    case 57  : hi2cout (SETSTARTLINE, 0x00, 0x46, 0x49, 0x49, 0x29, 0x1E ,0x00) ;9
    case 58  : hi2cout (SETSTARTLINE, 0x00, 0x00, 0x36, 0x36, 0x00, 0x00)       ;:
    case 59  : hi2cout (SETSTARTLINE, 0x00, 0x00, 0x56, 0x36, 0x00, 0x00)       ;;
    case 60  : hi2cout (SETSTARTLINE, 0x00, 0x41, 0x22, 0x14, 0x08, 0x00)       ;>
    case 61  : hi2cout (SETSTARTLINE, 0x00, 0x14, 0x14, 0x14, 0x14, 0x14 ,0x00) ;=
    case 62  : hi2cout (SETSTARTLINE, 0x00, 0x08, 0x14, 0x22, 0x41, 0x00)       ;<
    case 63  : hi2cout (SETSTARTLINE, 0x00, 0x02, 0x01, 0x51, 0x09, 0x06 ,0x00) ;?
    case 64  : hi2cout (SETSTARTLINE, 0x00, 0x32, 0x49, 0x79, 0x41, 0x3E ,0x00) ;@
    case 65  : hi2cout (SETSTARTLINE, 0x00, 0x7C, 0x12, 0x11, 0x12, 0x7C ,0x00) ;A
    case 66  : hi2cout (SETSTARTLINE, 0x00, 0x7F, 0x49, 0x49, 0x49, 0x36 ,0x00) ;B
    case 67  : hi2cout (SETSTARTLINE, 0x00, 0x3E, 0x41, 0x41, 0x41, 0x22 ,0x00) ;C
    case 68  : hi2cout (SETSTARTLINE, 0x00, 0x7F, 0x41, 0x41, 0x41, 0x3E ,0x00) ;D
    case 69  : hi2cout (SETSTARTLINE, 0x00, 0x7F, 0x49, 0x49, 0x49, 0x41 ,0x00) ;E
    case 70  : hi2cout (SETSTARTLINE, 0x00, 0x7F, 0x09, 0x09, 0x09, 0x01 ,0x00) ;F
    case 71  : hi2cout (SETSTARTLINE, 0x00, 0x3E, 0x41, 0x41, 0x51, 0x73 ,0x00) ;G
    case 72  : hi2cout (SETSTARTLINE, 0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F ,0x00) ;H
    case 73  : hi2cout (SETSTARTLINE, 0x00, 0x41, 0x7F, 0x41, 0x00)             ;I
    case 74  : hi2cout (SETSTARTLINE, 0x00, 0x20, 0x40, 0x41, 0x3F, 0x01 ,0x00) ;J
    case 75  : hi2cout (SETSTARTLINE, 0x00, 0x7F, 0x08, 0x14, 0x22, 0x41 ,0x00) ;K
    case 76  : hi2cout (SETSTARTLINE, 0x00, 0x7F, 0x40, 0x40, 0x40, 0x40 ,0x00) ;L
    case 77  : hi2cout (SETSTARTLINE, 0x00, 0x7F, 0x02, 0x1C, 0x02, 0x7F ,0x00) ;M
    case 78  : hi2cout (SETSTARTLINE, 0x00, 0x7F, 0x04, 0x08, 0x10, 0x7F ,0x00) ;N
    case 79  : hi2cout (SETSTARTLINE, 0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E ,0x00) ;O
    case 80  : hi2cout (SETSTARTLINE, 0x00, 0x7F, 0x09, 0x09, 0x09, 0x06 ,0x00) ;P
    case 81  : hi2cout (SETSTARTLINE, 0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E ,0x00) ;Q
    case 82  : hi2cout (SETSTARTLINE, 0x00, 0x7F, 0x09, 0x19, 0x29, 0x46 ,0x00) ;R
    case 83  : hi2cout (SETSTARTLINE, 0x00, 0x26, 0x49, 0x49, 0x49, 0x32 ,0x00) ;S
    case 84  : hi2cout (SETSTARTLINE, 0x00, 0x03, 0x01, 0x7F, 0x01, 0x03 ,0x00) ;T
    case 85  : hi2cout (SETSTARTLINE, 0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F ,0x00) ;U
    case 86  : hi2cout (SETSTARTLINE, 0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F ,0x00) ;V
    case 87  : hi2cout (SETSTARTLINE, 0x00, 0x3F, 0x40, 0x38, 0x40, 0x3F ,0x00) ;W
    case 88  : hi2cout (SETSTARTLINE, 0x00, 0x63, 0x14, 0x08, 0x14, 0x63 ,0x00) ;X
    case 89  : hi2cout (SETSTARTLINE, 0x00, 0x03, 0x04, 0x78, 0x04, 0x03 ,0x00) ;Y
    case 90  : hi2cout (SETSTARTLINE, 0x00, 0x61, 0x59, 0x49, 0x4D, 0x43 ,0x00) ;Z
    case 91  : hi2cout (SETSTARTLINE, 0x00, 0x00, 0x7F, 0x41, 0x41, 0x00 ,0x00) ;[
    case 92  : hi2cout (SETSTARTLINE, 0x00, 0x02, 0x04, 0x08, 0x10, 0x20, 0x00) ;
    case 93  : hi2cout (SETSTARTLINE, 0x00, 0X00, 0X41, 0X41, 0X7F, 0X00 ,0x00) ;]
    case 94  : hi2cout (SETSTARTLINE, 0x00, 0x04, 0x02, 0x01, 0x02, 0x04 ,0x00) ;^
    case 95  : hi2cout (SETSTARTLINE, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80 ,0x00) ;_
    case 97  : hi2cout (SETSTARTLINE, 0x00, 0x20, 0x54, 0x54, 0x54, 0x78 ,0x00) ;a
    case 98  : hi2cout (SETSTARTLINE, 0x00, 0x7F, 0x48, 0x44, 0x44, 0x38 ,0x00) ;b
    case 99  : hi2cout (SETSTARTLINE, 0x00, 0x38, 0x44, 0x44, 0x44, 0x20 ,0x00) ;c
    case 100 : hi2cout (SETSTARTLINE, 0x00, 0x38, 0x44, 0x44, 0x48, 0x7F ,0x00) ;d
    case 101 : hi2cout (SETSTARTLINE, 0x00, 0x38, 0x54, 0x54, 0x54, 0x18 ,0x00) ;e
    case 102 : hi2cout (SETSTARTLINE, 0x00, 0x08, 0x7E, 0x09, 0x01, 0x02 ,0x00) ;f
    case 103 : hi2cout (SETSTARTLINE, 0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C ,0x00) ;g
    case 104 : hi2cout (SETSTARTLINE, 0x00, 0x7F, 0x08, 0x04, 0x04, 0x78 ,0x00) ;h
    case 105 : hi2cout (SETSTARTLINE, 0x00 ,0x48, 0x7A, 0x40, 0x00)             ;i
    case 106 : hi2cout (SETSTARTLINE, 0x00, 0x40, 0x80, 0x88, 0x7A, 0x00)       ;j
    case 107 : hi2cout (SETSTARTLINE, 0x00, 0x7F, 0x10, 0x28, 0x44, 0x00)       ;k
    case 108 : hi2cout (SETSTARTLINE, 0x00, 0x41, 0x7F, 0x40, 0x00)             ;l
    case 109 : hi2cout (SETSTARTLINE, 0x00, 0x7C, 0x04, 0x18, 0x04, 0x78 ,0x00) ;m
    case 110 : hi2cout (SETSTARTLINE, 0x00, 0x7C, 0x08, 0x04, 0x04, 0x78 ,0x00) ;n
    case 111 : hi2cout (SETSTARTLINE, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38 ,0x00) ;o
    case 112 : hi2cout (SETSTARTLINE, 0x00, 0xFC, 0x24, 0x24, 0x24, 0x18 ,0x00) ;p
    case 113 : hi2cout (SETSTARTLINE, 0x00, 0x18, 0x24, 0x24, 0x28, 0xFC ,0x00) ;q
    case 114 : hi2cout (SETSTARTLINE, 0x00, 0x7C, 0x08, 0x04, 0x04, 0x08 ,0x00) ;r
    case 115 : hi2cout (SETSTARTLINE, 0x00, 0x48, 0x54, 0x54, 0x54, 0x20 ,0x00) ;s
    case 116 : hi2cout (SETSTARTLINE, 0x00, 0x04, 0x3F, 0x44, 0x40, 0x20 ,0x00) ;t
    case 117 : hi2cout (SETSTARTLINE, 0x00, 0x3C, 0x40, 0x40, 0x20, 0x7C ,0x00) ;u
    case 118 : hi2cout (SETSTARTLINE, 0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C ,0x00) ;v
    case 119 : hi2cout (SETSTARTLINE, 0x00, 0x3C, 0x40, 0x30, 0x40, 0x3C ,0x00) ;w
    case 120 : hi2cout (SETSTARTLINE, 0x00, 0x44, 0x28, 0x10, 0x28, 0x44 ,0x00) ;x
    case 121 : hi2cout (SETSTARTLINE, 0x00, 0x1C, 0xA0, 0xA0, 0xA0, 0x7C ,0x00) ;y
    case 122 : hi2cout (SETSTARTLINE, 0x00, 0x44, 0x64, 0x54, 0x4C, 0x44 ,0x00) ;z
    case 123 : hi2cout (SETSTARTLINE, 0x00, 0x00, 0x08, 0x36, 0x41, 0x00, 0x00) ;{
    case 125 : hi2cout (SETSTARTLINE, 0x00, 0x00, 0x41, 0x36, 0x08, 0x00, 0x00) ;}
    case 126 : hi2cout (SETSTARTLINE, 0x00, 0x08, 0x04, 0x08, 0x08, 0x04, 0x00) ;~
    case 166 : hi2cout (SETSTARTLINE, 0x00, 0x00, 0x63, 0x00, 0x00)             ;¦
    case 176 : hi2cout (SETSTARTLINE, 0x00, 0x02, 0x05, 0x02, 0x00, 0x00)       ;°
      case 196 : hi2cout (SETSTARTLINE, 0x00, 0x7D, 0x12, 0x11, 0x12, 0x7D, 0x00) ;Ä
    case 214 : hi2cout (SETSTARTLINE, 0x00, 0x3D, 0x42, 0x42, 0x42, 0x3D, 0x00) ;Ö
    case 220 : hi2cout (SETSTARTLINE, 0x00, 0x3D, 0x40, 0x40, 0x40, 0x3D, 0x00) ;Ü
    case 223 : hi2cout (SETSTARTLINE, 0x00, 0x7E, 0x01, 0x49, 0x55, 0x73, 0x00) ;ß
    case 228 : hi2cout (SETSTARTLINE, 0x00, 0x21, 0x54, 0x54, 0x54, 0x79, 0x00) ;ä
    case 246 : hi2cout (SETSTARTLINE, 0x00, 0x39, 0x44, 0x44, 0x44, 0x39, 0x00) ;ö
    case 252 : hi2cout (SETSTARTLINE, 0x00, 0x3D, 0x40, 0x40, 0x20, 0x7D, 0x00) ;ü
    endselect 
return
      
ClearPage:   
      if LongeurRF < 128 then : inc LongeurRF : hi2cout (SETSTARTLINE,0x00) : goto ClearPage endif
       LongeurRF = 0
return

ClearDisplay:
     gosub DISPLAY_OFF
     NumASCII = 0
     ClearDisplayInt:
     if NumASCII < 16 then : gosub Numero : gosub ClearPage : inc NumASCII : goto ClearDisplayInt endif
     gosub DISPLAY_ON 
return

SetPosition:
      if X > 127 then : X = 127 endif
      select case X
    case 0   to 15  : ColumLowBits = X       : ColumHighBits = 0
    case 16  to 31  : ColumLowBits = X - 16  : ColumHighBits = 1
    case 32  to 47  : ColumLowBits = X - 32  : ColumHighBits = 2
    case 48  to 63  : ColumLowBits = X - 48  : ColumHighBits = 3
    case 64  to 79  : ColumLowBits = X - 64  : ColumHighBits = 4
    case 80  to 95  : ColumLowBits = X - 80  : ColumHighBits = 5
    case 96  to 111 : ColumLowBits = X - 96  : ColumHighBits = 6
    case 112 to 127 : ColumLowBits = X - 112 : ColumHighBits = 7
    'case 128 to 131 : ColumLowBits = X - 128 : ColumHighBits = 8 'SH1106
    endselect 

      ColumHighBits = SetColumHighBits + ColumHighBits
      hi2cout (0, ColumHighBits)
      hi2cout (0, ColumLowBits)
 
return

DrawsPixel:
     if Y > 127 then : Y = 127 endif
     select case Y
     case   0 to   7 : Page = 176 : R_graphiqueLCD = Y
     case   8 to  15 : Page = 177 : R_graphiqueLCD = Y -   8
     case  16 to  23 : Page = 178 : R_graphiqueLCD = Y -  16
     case  24 to  31 : Page = 179 : R_graphiqueLCD = Y -  24
     case  32 to  39 : Page = 180 : R_graphiqueLCD = Y -  32
     case  40 to  47 : Page = 181 : R_graphiqueLCD = Y -  40
     case  48 to  55 : Page = 182 : R_graphiqueLCD = Y -  48
     case  56 to  63 : Page = 183 : R_graphiqueLCD = Y -  56
     case  64 to  71 : Page = 184 : R_graphiqueLCD = Y -  64
     case  72 to  79 : Page = 185 : R_graphiqueLCD = Y -  72
     case  80 to  87 : Page = 186 : R_graphiqueLCD = Y -  80
     case  88 to  95 : Page = 187 : R_graphiqueLCD = Y -  88
     case  96 to 103 : Page = 188 : R_graphiqueLCD = Y -  96
     case 104 to 111 : Page = 189 : R_graphiqueLCD = Y - 104
     case 112 to 119 : Page = 190 : R_graphiqueLCD = Y - 112
     case 120 to 127 : Page = 191 : R_graphiqueLCD = Y - 120
     endselect

     ClearY = R_graphiqueLCD
        
     select case R_graphiqueLCD
     case 0 : R_graphiqueLCD = 0x01 
     case 1 : R_graphiqueLCD = 0x02
     case 2 : R_graphiqueLCD = 0x04 
     case 3 : R_graphiqueLCD = 0x08 
     case 4 : R_graphiqueLCD = 0x10 
     case 5 : R_graphiqueLCD = 0x20
     case 6 : R_graphiqueLCD = 0x40
     case 7 : R_graphiqueLCD = 0x80 
     endselect
                                   
     select case Y
     case 0 to 127
     gosub SetPosition : hi2cout (0,Page) : hi2cin SETSTARTLINE,(BitsTempon,L_graphiqueLCD)
                   
     if bit0 = 1 then : bit8  = 1 endif
     if bit1 = 1 then : bit9  = 1 endif
     if bit2 = 1 then : bit10 = 1 endif
     if bit3 = 1 then : bit11 = 1 endif
     if bit4 = 1 then : bit12 = 1 endif
     if bit5 = 1 then : bit13 = 1 endif
     if bit6 = 1 then : bit14 = 1 endif
     if bit7 = 1 then : bit15 = 1 endif

     if ClearPixel <> 0 then
     if ClearY = 0 then : bit8  = 0 endif
     if ClearY = 1 then : bit9  = 0 endif
     if ClearY = 2 then : bit10 = 0 endif
     if ClearY = 3 then : bit11 = 0 endif
     if ClearY = 4 then : bit12 = 0 endif
     if ClearY = 5 then : bit13 = 0 endif
     if ClearY = 6 then : bit14 = 0 endif
     if ClearY = 7 then : bit15 = 0 endif
     endif
      
     if L_graphiqueLCD <> R_graphiqueLCD then : gosub SetPosition : hi2cout (0,Page) : hi2cout (SETSTARTLINE,R_graphiqueLCD) endif
     endselect
                 
return

AngleXY:
        AngleX = sin AngleX1 * Print / 100
        AngleY = cos AngleX1 * Print / 100
return

AngleYX:
     AngleY = sin AngleX1 * Print / 100
     AngleX = cos AngleX1 * Print / 100
return

DrawsLine:
     select case AngleX1
     case   0 to 180 : if   AngleX1 >=  90 and X_Neatif = 0 then : X_Neatif = 1 : AngleX1 = AngleX1 -  90 : endif
     case 181 to 360 : if   AngleX1 >= 270 and Y_Neatif = 0 then : AngleX1  = AngleX1 - 270 : Y_Neatif = 1 
                       else X_Neatif =   1 :   Y_Neatif = 1      : AngleX1  = AngleX1 - 180 : endif
     endselect  
    
     if X_Neatif = 0 and Y_Neatif = 0 then : gosub AngleYX endif
     if X_Neatif = 1 and Y_Neatif = 0 then : gosub AngleXY endif
     if X_Neatif = 1 and Y_Neatif = 1 then : gosub AngleYX endif
     if X_Neatif = 0 and Y_Neatif = 1 then : gosub AngleXY endif

     if X_Neatif = 0 then : x = x0 + AngleX else : x = x0 - AngleX endif
     if Y_Neatif = 0 then : y = y0 + AngleY else : y = y0 - AngleY endif
      
     gosub DrawsPixel 'Dessine des pixeles   
     
     if Print =< X1 and stipple = 1 then : inc Print endif
     if Print =< X1 then : inc Print : goto DrawsLine else : Y_Neatif = 0 : X_Neatif = 0 : Print = 0 endif
return

AngleSinYCosX:
     AngleY = sin Print * Y1 / 100
     AngleX = cos Print * X1 / 100
return
  
DrawsCircle:
     DrawsCircle0_90:
     gosub AngleSinYCosX
     if Print =< 90 and stipple = 1 then : inc Print endif'dessine en pointiller
     x = x0 + AngleX : y = y0 - AngleY       : gosub DrawsPixel 'Dessine des pixeles     
     if Print =< 90 then : inc Print     : goto  DrawsCircle0_90 endif

     DrawsCircle90_180:
     gosub AngleSinYCosX
     if Print > 0  and stipple = 1 then  : dec Print endif'dessine en pointiller
     x = x0 - AngleX : y = y0 - AngleY   : gosub DrawsPixel 'Dessine des pixeles     
     if Print > 0 then : dec Print       : goto  DrawsCircle90_180 endif

     DrawsCircle180_270:
     gosub AngleSinYCosX
     if Print =< 90 and stipple = 1 then : inc Print endif'dessine en pointiller
     x = x0 - AngleX : y = y0 + AngleY   : gosub DrawsPixel 'Dessine des pixeles
     if Print =< 90 then : inc Print     : goto  DrawsCircle180_270 endif

     DrawsCircle270_0: 
     gosub AngleSinYCosX
     if Print > 0  and stipple = 1 then  : dec Print endif'dessine en pointiller
     x = x0 + AngleX : y = y0 + AngleY   : gosub DrawsPixel 'Dessine des pixeles
     if Print > 0 then : dec Print       : goto  DrawsCircle270_0 endif
return

DrawsRectangle:
     DrawsLignevertical_H:
     if Print < y1  and stipple = 1 then : inc Print endif'dessine en pointiller
     y = y0 + Print : x = x0        : gosub DrawsPixel 'Dessine des pixeles
     if Print < y1 then : inc Print : goto  DrawsLignevertical_H else: Print = 0 endif

     DrawsLignehorizontal_H:
     if Print < x1  and stipple = 1 then : inc Print endif'dessine en pointiller
     x = x0 + Print : y = y1 + y0   : gosub DrawsPixel 'Dessine des pixeles
     if Print < x1 then : inc Print : goto  DrawsLignehorizontal_H else : Print = 0 endif
             
     DrawsLignehorizontal_L:
     if Print < x1  and stipple = 1 then : inc Print endif'dessine en pointiller
     x = x0 + Print : y = y0        : gosub DrawsPixel 'Dessine des pixeles
     if Print < x1 then : inc Print : goto  DrawsLignehorizontal_L else : Print = 0 endif
       
     DrawsLignevertical_L:
     if Print < y1  and stipple = 1 then : inc Print endif'dessine en pointiller
     y = y0 + Print : x = x1 + x0   : gosub DrawsPixel 'Dessine des pixeles
     if Print < y1 then : inc Print : goto  DrawsLignevertical_L else : Print = 0 endif
return

SensPixelConfigInitial:
 'Low LedBleu
 if BP_0 = 1 then : gosub EffetMiroir_1 : gosub EffetRotation_1 else : gosub EffetMiroir_2 : gosub EffetRotation_2 endif
 'High LedVert
 return

SensPixelConfigMiroir:
 'Low LedVert
 if BP_0 = 1 then : gosub EffetMiroir_2 : gosub EffetRotation_1 else : gosub EffetMiroir_1 : gosub EffetRotation_2 endif
 'High LedBleu
return
    
DISPLAY_ON:      hi2cout (0, CHARGEPUMP)       : hi2cout (0, 0x14)       : hi2cout (0, DISPLAYON) : return
DISPLAY_OFF:     hi2cout (0, DISPLAYOFF)       : hi2cout (0, CHARGEPUMP) : hi2cout (0, 0x10)      : return
ContrasteMode:   hi2cout (0, SETCONTRAST)      : hi2cout (0, Contraste)  : return
OffsetMode:      hi2cout (0, SETDISPLAYOFFSET) : hi2cout (0, OffsetX)    : return
EffetMiroir_1:   hi2cout (0x00, 0xA1)    : return
EffetMiroir_2:   hi2cout (0x00, 0xA0)    : return
EffetRotation_1: hi2cout (0x00, 0xC8)    : return
EffetRotation_2: hi2cout (0x00, 0xC0)    : return
InversDisplay:   hi2cout (0x00, 0xA7)    : return
NormalDisplay:   hi2cout (0x00, 0xA6)    : return



 
Afficher la suite de cette page



Créer un site
Créer un site