Quantcast
Channel: MEL PICBASIC Forum
Viewing all 4745 articles
Browse latest View live

timer0 10ms setting check

$
0
0
HI guys , i transfer some code from another processor which from the data sheet hs the same registers but seem to be getting a 20ms timer0 , not a 10ms interupt

all looks correct but it cant be , can someone have a look and see where i made the error

pic 18f46k80
osc32 internal,
timer 0 to give a 10ms interupt

Code:


;----- CONFIG1L Options --------------------------------------------------
    CONFIG XINST    = OFF
    CONFIG SOSCSEL  = DIG        ; Digital (SCLKI) mode; I/O port functionality of RC0 and RC1 is enabled
    CONFIG INTOSCSEL = LOW        ; LF-INTOSC in low-power mode during Sleep
    CONFIG RETEN    = ON        ; Ultra Low power regulator is Enabled  (Controlled by SRETEN bit)when in sleep

;----- CONFIG1H Options --------------------------------------------------
    CONFIG IESO      = OFF
    CONFIG FCMEN    = OFF
    CONFIG PLLCFG    = ON
    CONFIG FOSC      = INTIO2    ; Internal RC oscillator  , PORTA.6 , PORTA.7 as I/O


Code:

  OSCCON  = %01100000    ' Select 32Mhz - using 8Mhz internal with PPLx4 in Config1H<3:0>  =  IDLEN =0 , 8Mhz , OSTS=0,RFIOFS=1,RC_Run (1x) OSC using PLL 
                            ' Bit 7 IDLEN =0 ( sleep mode when sleep instraction executed)
                            ' Bits 6-4 -  111 = 16Mhz , 110 = 8MHz ,101 = 4 MHz, 100 = 2MHz 011 = 1MHz
                            ' If INTTSRC=0 and MFIOSEL= 0 then 010 = HF-INTOSC/32 (500Khz), 001 = HF-INTOSC/64 (250Khz) ,000 = LF-INTOSC    (31.25Khz)
                            ' If INTTSRC=0 and MFIOSEL= 1 then 010 = MF-INTOSC    (500Khz), 001 = MF-INTOSC/2  (250Khz) ,000 = LF-INTOSC    (31.25Khz)
                            ' If INTTSRC=1 and MFIOSEL= 0 then 010 = HF-INTOSC/32 (500Khz), 001 = HF-INTOSC/64 (250Khz) ,000 = HF-INTOSC/512 (31.25Khz)
                            ' If INTTSRC=1 and MFIOSEL= 1 then 010 = MF-INTOSC    (500Khz), 001 = MF-INTOSC/2  (250Khz) ,000 = MF-INTOSC/16  (31.25Khz)
                            ' Note: INTSRC = OSCTUNE<7> and MFIOSEL = OSCCON2<0>
                            ' Bit 3 - OSTS = 0 - Osc startup time out  is ruinning from internal OSC ( HF, MF or LF-INTOSC)
                            ' Bit 2 - HFIOFS =1 ( INTOSC Frq stable bit  -  1 = stable , 0 = not stable
                            ' Bits 1-0 - 00= Dephalt Pri OSc ( OSC1/2 or HF-INTOSC with/without PLL set in FOSC,3:0> config1H <3.0>
                            '            01 = SOSC osc
                            '            1x = Internal osc ( LF, MF,HF-INTOSC) 
 
  ' OSCCON2 = $00            ' Bit 7 n/a , Bit 6 - SOSCRUN - Run status bit , Bit 5-4 n/a,
                            ' Bit 3 = SOASCGO - Osc Start control bit 1 = OSC running , 0 = OSC shut off if no requests for it
                            ' Bit 2 n/a , Bit 1 - MFIOFS 1= MFINTOSC stable  0 = Not stable
                            ' Bit 0 MFIOSEL - 1 = MF-INTOSC replaces HF-ISTOSC Freq for 500Khz,250Khz,31.25KHz) 0 = MF-INTOSC not used
 
  OSCTUNE = %01000000      ' Bit 7  - INTSRC - internal LF Source Select 1 = 31.25 from 16Mhz Internal /512 HF-INTOSC ) 0 = Internal 31khz OSC
                            ' Bit 6 - PLLEN - 1 PLL enabled  , 0 = PLL disabled
                            ' Bits 5-0 Frequancy callibaration 00000 = centre Frq

Code:



  ' ---------- Timer 0 Register Setups ----------------
    INTCON2.2 = 1          ' TMR0IP  - TIMER 0 Overflow Interupt Priority - 1 = High Priorty , 0 = Low Priority
    T0CON.7 = 1            ' Bit7 - TMR0 1= Enable 0 = Stop timer
    T0CON.6 = 0            ' Bit6 - TMR0 8/16bit control 1= 8bit 0=16bit,
    T0CON.5 = 0            ' Bit5 - TMR0 Clock Source 1=clk on T0CKI pin input 0=Internal clcck (Fosc/4)
    T0CON.4 = 0            ' Bit4 - TMR0 Source Edge Select 1= H/L of TOCKI 0= L/H of TOCKI ,
    T0CON.3 = 0            ' Bit3 - TMR0 PSA select 1=TMR0 Bypass Prescaler 0= CLK Input from Prescaler output     
    T0CON.2 = 0            ' Bit2-0 - Timer0 prescaler Rate Select bits 2-0(set to 1:256)       
    T0CON.1 = 0            ' 000 = 1:2  , 001= 1:4  , 010 = 1:8  , 011 = 1:16     
    T0CON.0 = 0            ' 100 = 1:32 , 101 = 1:64, 110 = 1:128 , 111 = 1:256

Code:

' ---------- Set up DT_INTS-18 Routine for Instant Interupt handling  -----------
 
    INCLUDE "DT_INTS-18.bas"      ; Base Interrupt System for 18FxxK80 processors
    INCLUDE "ReEnterPBP-18.bas"    ; Include if using PBP interrupts
   
ASM
INT_LIST macro        ; IntSource  ,    Label    , Type, ResetFlag?

  INT_Handler TMR0_INT, _Timer0_Count,  PBP, yes      ; call Timer0_Count subroutine
 
 endm
 INT_CREATE                                                                ; Creates the Interrupt Processor
ENDASM


Code:



' ============ Timer 0 Interupt handler ================
 ' a 10 ms timer interupt

  Timer0_Count:
   
    INTCON.5 = 0                ' STOP TIMER
  T0Count1 = T0Count1 + 1      ' inc counter on interupt flag
    TMR0H = $63              ' preset Timer 0 to a 10ms timer
    TMR0L = $C0                             
    INTCON.5 = 1                ' START TIMER
@ INT_RETURN
    RETURN


Someone trying to hack my account?

$
0
0
I keep getting notifications that someone is trying to get into my account. Every few months or so I get an email from lester.wilson@gmail.com saying that someone from 188.138.1.229 is has failed to guess my login password and has been locked out.

This IP has also attempted to login to the account a few months ago.
185.26.122.50

Is this a real notification?

Is anyone else in this forum also having hack attempts?

No one I know would have any interest in using my account. I don't even know why a stranger would want my account.

Error Compiling with PbP 3

$
0
0
Hello Guys !

Finally, I got my PbP 3 License last week.

I have just installed it in my notebook and tryed to compile an old source code designed for 16F877A.

My source code is using the Darrell's interrupts, lcdbar and some other resources.

As I define a new @ __CONFIG on my source code, I commented a line on the .INC file on my old 2.46 version to avoid the error : overwriting previous address contents (2007)

Now, I´m trying to compile the same source code on my PbP 3 and MPASMX.

The error showed up again, of course, because I did not edit the new inc file.

Following the advice Henrik Olsson gave on the post bellow :


http://support.melabs.com/archive/in...p/t-1065.html?

My original code :

Code:

@ ERRORLEVEL -306  ; Retira o erro de crossing page boundary
@ __CONFIG  _CP_OFF  & _DEBUG_OFF & _CP_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _PWRTE_ON & _WDT_OFF & _XT_OSC   


Include "LCDbar_INC.bas"
Include "DT_INTS-14.bas"    ' Base Interrupt System
Include "ReEnterPBP.bas"    ' Include if using PBP interrupts

define OSC 4

When I compile, I get the overwriting previous address contents (2007) error, because we have two __CONFIG on ASM.

So, I put the #CONFIG / ENDCONFIG in the code , like this :

Code:


#CONFIG
@ ERRORLEVEL -306  ; Retira o erro de crossing page boundary
@ __CONFIG  _CP_OFF  & _DEBUG_OFF & _CP_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _PWRTE_ON & _WDT_OFF & _XT_OSC   
#ENDCONFIG

Include "LCDbar_INC.bas"
Include "DT_INTS-14.bas"    ' Base Interrupt System
Include "ReEnterPBP.bas"    ' Include if using PBP interrupts

define OSC 4 l

Now, when I compile, I get the errors :

[ASM ERRORS] COMPB.ASM (29) : Illegal label (@)
[ASM ERRORS] COMPB.ASM (30) : Illegal label (@)

I would not like to edit the INC files anymore.

So, could someone, please, help me ?

Is there a specific place where I have to put the #CONFIG... block on the code ?

Thank you very much

Sérgio

USART2 setting for 1MHzCPU + 4PLL

$
0
0
Hi guys

this is new one for me

i normally have run the cpus at 32Mhz or 64Mhz and the setting i have for the USART2 at those speeds has worked fine in the past and work on this device when i set it up for 32 or 64Mhz

but now i need to drop the power usage down as low as i can , which has ment droping the clock as low as i can for the application to work

as a result i have set the main cpu at 1mhz , and enabled the PPL to give me a 4Mhz cpu.

However my terminal now refuses to work ,at the lower speed , i do see some chrs on the terminal but they are rubbish so clearly the baud rate is a problem

when using the 32Mhz setting and tried other buad rate down to 9600 and works ok

but now trying the 4mhz i get nothing or sometime s just rubbish

any thoughts

Cheers

sheldon

Code:

DEFINE OSC 32                ' Timing referance for pause , pauseus commands
    DEFINE ADC_BITS 12          ' Number of bits in ADCIN result - Required for adcin command
    DEFINE PULSIN_MAX 2000      ' Maximum counts( clock ticks) allowed before pulsin times out( 2000 ^ 1.25us =  2.5 ms)
    DEFINE HSER_PORT 2          ' Hser port 2 use
    DEFINE HSER2_RCSTA 90h      ' Hser2 receive status init
    DEFINE HSER2_TXSTA 24h      ' Hser2 transmit status init
    DEFINE HSER2_BAUD 38400      ' Hser2 baud rate


when cpu at 4mhz have just droped the buad rate 4800

Code:

DEFINE OSC 4                ' Timing referance for pause , pauseus commands
    DEFINE ADC_BITS 12          ' Number of bits in ADCIN result - Required for adcin command
    DEFINE PULSIN_MAX 2000      ' Maximum counts( clock ticks) allowed before pulsin times out( 2000 ^ 1.25us =  2.5 ms)
    DEFINE HSER_PORT 2          ' Hser port 2 use
    DEFINE HSER2_RCSTA 90h      ' Hser2 receive status init
    DEFINE HSER2_TXSTA 20h      ' Hser2 transmit status init
    DEFINE HSER2_CLROERR 1      ' Clear overflow automatically
    DEFINE HSER2_BAUD 4800      ' Hser2 baud rate

other osc settings for 4mhz


Code:


  OSCCON  = %00110000    ' Select 1Mhz - using 1Mhz internal with PPLx4 in Config1H<3:0>  =  IDLEN =0 , 8Mhz , OSTS=0,RFIOFS=1,RC_Run (1x) OSC using PLL 
                            ' Bit 7 IDLEN =0 ( sleep mode when sleep instraction executed)
                            ' Bits 6-4 -  111 = 16Mhz , 110 = 8MHz ,101 = 4 MHz, 100 = 2MHz 011 = 1MHz
                            ' If INTTSRC=0 and MFIOSEL= 0 then 010 = HF-INTOSC/32 (500Khz), 001 = HF-INTOSC/64 (250Khz) ,000 = LF-INTOSC    (31.25Khz)
                            ' If INTTSRC=0 and MFIOSEL= 1 then 010 = MF-INTOSC    (500Khz), 001 = MF-INTOSC/2  (250Khz) ,000 = LF-INTOSC    (31.25Khz)
                            ' If INTTSRC=1 and MFIOSEL= 0 then 010 = HF-INTOSC/32 (500Khz), 001 = HF-INTOSC/64 (250Khz) ,000 = HF-INTOSC/512 (31.25Khz)
                            ' If INTTSRC=1 and MFIOSEL= 1 then 010 = MF-INTOSC    (500Khz), 001 = MF-INTOSC/2  (250Khz) ,000 = MF-INTOSC/16  (31.25Khz)
                            ' Note: INTSRC = OSCTUNE<7> and MFIOSEL = OSCCON2<0>
                            ' Bit 3 - OSTS = 0 - Osc startup time out  is ruinning from internal OSC ( HF, MF or LF-INTOSC)
                            ' Bit 2 - HFIOFS =1 ( INTOSC Frq stable bit  -  1 = stable , 0 = not stable
                            ' Bits 1-0 - 00= Dephalt Pri OSc ( OSC1/2 or HF-INTOSC with/without PLL set in FOSC,3:0> config1H <3.0>
                            '            01 = SOSC osc
                            '            1x = Internal osc ( LF, MF,HF-INTOSC) 
 
  ' OSCCON2 = $00            ' Bit 7 n/a , Bit 6 - SOSCRUN - Run status bit , Bit 5-4 n/a,
                            ' Bit 3 = SOASCGO - Osc Start control bit 1 = OSC running , 0 = OSC shut off if no requests for it
                            ' Bit 2 n/a , Bit 1 - MFIOFS 1= MFINTOSC stable  0 = Not stable
                            ' Bit 0 MFIOSEL - 1 = MF-INTOSC replaces HF-ISTOSC Freq for 500Khz,250Khz,31.25KHz) 0 = MF-INTOSC not used
 
  OSCTUNE = %01000000      ' Bit 7  - INTSRC - internal LF Source Select 1 = 31.25 from 16Mhz Internal /512 HF-INTOSC ) 0 = Internal 31khz OSC
                            ' Bit 6 - PLLEN - 1 PLL enabled  , 0 = PLL disabled
                            ' Bits 5-0 Frequancy callibaration 00000 = centre Frq

Program 3 PICs using one PICKIT 3. Possible?

$
0
0
Hi All,

I have a project where there are 3 818's on the same PCB, and with the same software.
Has anyone tried programming multiple devices, at the same time using a Pickit 3?

Regards
Bob.

Major problem after PC crash

$
0
0
Slightly off toppic, but related to PBP installation.

My PC suffered a crash at the weekend - mainly corrupted file structure, but as a result I've purchased a new drive and started from fresh. I've installed PBP2.60, MSC and MPlab 8.90 (also tried later versions of MPLab). I've set MCS to point to the PBP.exe, MPASM folder (with used MPSAM box checked) and created a custom programmer for PICFLASH which is used with my EasyPIC5 board. But now when I compile, I get a blank DOS box when compiling rather then the small window with the green progress bar.

I've tried several installations (including a fresh formatted drive) and still get the same issue. - anyone have any ideas ?

Just to clarify, the DOS box title bar has C:\Progra~\MPASMS~\mpasmwin.exe and no text appears in the box, just a flashing cursor

PIC 18F device suggestion.

$
0
0
Hello Guys !

I have an old non-commercial project running on a 16F877 @ 4mhz and a 4x20 lcd.

The project is based on Darrel's interrupts libraries, with the following configuration :

TMR0 as a pulse counter, to calcualte the car´s speed
TMR1 as CCP1 to calculate the fuel consumption
TMR2 as a 500 ms time base.

This arrangement is working good, but I would like to improve it and use the Richard's ST7735 display Lib for a better presentation and, also, read the RPM form the car. So, I think I'd need another Timer/Counter.

I´m planning to keep using the Darrel's interrupts libraries (18F version).

I have some PIC18LF2420 here with me and I was reading its Datasheet.

In the Datasheet's Timers section, they say that TMR3 can not be used as an independent counter, because TMR1 and TMR3 share the same pin T13CKI for their external input.

So, should I search for another device with more timers if I need to read the Car's RPM ?

If yes, is there a suggestion for a new device I should consider ?

Thank you very much.

Sérgio.

Using external EEprom - need a little guidance

$
0
0
Guys, having a blonde moment here....

I want to save data to an external chip, a 24c256 EEPROM, but I can't seem to make it work the way I currently save data to the flash in the PIC.

Using a DS1307 RTC as an example I2CWrite SDApin,SCLpin,$D0,$00,[RTCSec,RTCMin,RTCHour,RTCWDay,RTCDay,RTCMonth,RTCY ear,RTCCtrl] works fine as each time the update is made it writes the complete string of variables so they remain in the correct order when read back. However I have used designated memory locations eg

Code:

WRITE  $50,lightsetHR[0],lightsetMN[0],lightoffHR[0],lightoffMN[1],word droptemp[0] ,word normtemp[0],StartMin[0],StopHour[0],StopMin[0],word alarmhigh[0],StartHour[0],word alarmlow[0]
write  $60,lightsetHR[1],lightsetMN[1],lightoffHR[1],lightoffMN[1],word droptemp[1] ,word normtemp[1],StartMin[1],StopHour[1],StopMin[1],word alarmhigh[1],StartHour[1],word alarmlow[1]

How would I impliment this so it uses the 24c256, do I use the second hex address in the I2CWrite SDApin,SCLpin,$D0,$00, statement thus:

Code:

I2CWrite SDApin,SCLpin,$A0,$50 [lightsetHR[0],lightsetMN[0],lightoffHR[0],lightoffMN[1],word droptemp[0] etc etc...]
I2CWrite SDApin,SCLpin,$A0,$60 [lightsetHR[1],lightsetMN[1], etc etc...... ]


Take this action when these numbers are reached. How?

$
0
0
Is there a way to select an action when a specific number is reached in a counter?

For example, if I write:
Code:

counter = 0

loophere:
 if counter = 21 then counter = 0

counter = counter + 1

pause 100

goto loophere

What I would like to do is along the lines of:

if counter = 2 or 4 or 6 or 8 or 10 then
led1 = 1
else
led1 = 0
endif

if counter = 12 or 14 or 16 or 18 or 20 then
led2 = 1
else
led2 = 0
endif

I know you can write individual lines such as:

if (counter = 2) OR (counter = 4) OR (counter = 6)...then

or

if counter = 2 then
led1 = 1
else
led1 = 0
endif

if counter = 4 then
led1 = 1
else
led1 = 0
endif


And so on, but that eats up too much space. Just looking for someone to point me in the right direction. It's late and I'm drawing a blank as to which method to use to save space, but still get it done.

Thanks,
Tony

Weird reboot & Halt

$
0
0
Hello dear friends,

In brief, I use 16F877A for running a long program (approximately over 7800 words) and I use these numbers of variables at my prog:
  • 15 variables as WORD.
  • 26 variables as BYTE.
  • Approximately 10 variables as BIT.
  • 17 ALIAS
And:
  • DT. Inst.int. for making an 1 sec. time base(TIMER1). I use the same way he explained as sample on his most valuable webpage. Thanks a lot to him for his wonderful works for ever. This link
  • Serial-in & Serial-out.
  • HPWM.
  • LCDOUT commands.
And inside of my program, there are lots of logical comparative commands, jumps and GOSUB commands.

It be compiled correctly, I run my program and after some seconds I see a weird-reboot happens. I think STACK OVERFLOW happens. (not sure).

As a quick solution, I thought it would be better if I move from 16F877A to 18F4520.
Now I have another problem on this 18F4520 chip. My LCD shows nothing if I compile and download HEX file of this long program to 18F4520.

I should say: 18F4520 works with simple programs such as DT Elapsed Timer which means I was cared about 18Fs INCLUDE files and hardware connections and wirings between LCD and MCU and so on.

Is any suggestion HOW I can get rid of these two issues:

1) weird-reboot on 16F877A
2) Halt in 18F4520. When I use LCD and DT ins. int.

All suggestions are welcome.

Thank you very much in advance for participating and help

Kind regards,

Andy

P.S. I am newcomer in PIC world, Mecanique MicroCode Studio 2.5 pro + MPASM 8.15a

mounting on world

DEFINE OSC for 31 khz

$
0
0
Hello everyone

Is there a way to run a pic at 31khz osc with picbasic pro ?

As far as I read the user manual , the compiler allows only minimum 3 Mhz define osc setting ...

I need that osc speed for only extreme low power comsumption ..

Thanks .

How many AND / OR are accepted ?

$
0
0
good day ,
I have a very simple qestion regarding the number of AND and OR can be put in the " if " control under PicbasicPro.
Eg.: if (a>b) AND (c>d ) AND (e>f) AND (g>h) AND (i>l ) AND ( m>n) AND (o>p) THEN ....
How many AND / OR are accepted ?
Thanks
Ambro

sms alert

$
0
0
dear..
i have sms aler project hardware and code.it's working stating time and 2 or 3 hours then not working .please help me. wavecom M1206B modem and max232 circuit.(for max 232 circuit 16v/10uf capacitor)

DEFINE OSC 4
DEFINE HSER_TXSTA 20h
DEFINE HSER_RCSTA 90h
DEFINE HSER_BAUD 2400
DEFINE HSER_SPBRG 25
DEFINE HSER_CLROERR 1
PortDStatus var BYTE
TRISB=%00000000
PORTB=%00000000
trisD=%00001111
portD=%00000000
GSM_CHECK:
portb=%11110000
pause 15000
HSEROUT ["AT",13]
HSERIN 5000, GSM_CHECK, [WAIT("OK")]
PAUSE 100
portb=%01110000
HSEROUT ["at+cmgs=",34,"0718623462",34,13]
PAUSE 100
HSEROUT ["system ok",26]
HSERIN 5000, BEGIN, [WAIT("OK")]
pause 200
PORTB=%00000000
'get initial status
PortDStatus.0 = PORTD.0
PortDStatus.1 = PORTD.1
PortDStatus.2 = PORTD.2
BEGIN:
HSEROUT ["AT",13]
HSERIN 5000, GSM_CHECK, [WAIT("OK")]
PAUSE 100
high PORTB.3
if PORTD.0 != PortDStatus.0 then
pause 10
PortDStatus.0 = PORTD.0
if PORTD.0 = 1 then
gosub SEND_SMS0
else
gosub SEND_SMS1
endif
endif
if PORTD.1 != PortDStatus.1 then
pause 10
PortDStatus.1 = PORTD.1
IF PORTD.1 = 1 then
gosub SEND_SMS2
else
gosub SEND_SMS3
endif
endif
if PORTD.2 != PortDStatus.2 then
pause 10
PortDStatus.2 = PORTD.2
IF PORTD.2 = 1 then
gosub SEND_SMS4
else
gosub SEND_SMS5
endif
endif
PAUSE 100
LOW PORTB.3
GOTO BEGIN
SEND_SMS0:
HIGH PORTB.4
HSEROUT ["at+cmgs=",34,"0718623462",34,13]
HSEROUT ["unit ,1,Synchronise",26]
HSERIN 15000, BEGIN, [WAIT("OK")]
HSEROUT ["at+cmgs=",34,"0715354064",34,13]
HSEROUT ["unit ,1,Synchronise",26]
HSERIN 15000, BEGIN, [WAIT("OK")]
HSEROUT ["at+cmgs=",34,"0712537063",34,13]
HSEROUT ["unit ,1,Synchronise",26]
HSERIN 15000, BEGIN, [WAIT("OK")]
LOW PORTB.4
return
SEND_SMS1:
HIGH PORTB.4
HSEROUT ["at+cmgs=",34,"0718623462",34,13]
HSEROUT ["unit ,1, triped",26]
HSERIN 15000, BEGIN, [WAIT("OK")]
HSEROUT ["at+cmgs=",34,"0715354064",34,13]
HSEROUT ["unit ,1, triped",26]
HSERIN 15000, BEGIN, [WAIT("OK")]
HSEROUT ["at+cmgs=",34,"0712537063",34,13]
HSEROUT ["unit ,1, triped",26]
HSERIN 15000, BEGIN, [WAIT("OK")]
LOW PORTB.4
return
SEND_SMS2:
HIGH PORTB.5
HSEROUT ["at+cmgs=",34,"0718623462",34,13]
HSEROUT ["unit,2,Synchronise",26]
HSERIN 15000, BEGIN, [WAIT("OK")]
HSEROUT ["at+cmgs=",34,"0715354064",34,13]
HSEROUT ["unit,2,Synchronise",26]
HSERIN 15000, BEGIN, [WAIT("OK")]
HSEROUT ["at+cmgs=",34,"0712537063",34,13]
HSEROUT ["unit,2,Synchronise",26]
HSERIN 15000, BEGIN, [WAIT("OK")]
LOW PORTB.5
return
SEND_SMS3:
HIGH PORTB.5
HSEROUT ["at+cmgs=",34,"0718623462",34,13]
HSEROUT ["unit,2,triped",26]
HSERIN 15000, BEGIN, [WAIT("OK")]
HSEROUT ["at+cmgs=",34,"0715354064",34,13]
HSEROUT ["unit,2,triped",26]
HSERIN 15000, BEGIN, [WAIT("OK")]
HSEROUT ["at+cmgs=",34,"0712537063",34,13]
HSEROUT ["unit,2,triped",26]
HSERIN 15000, BEGIN, [WAIT("OK")]
LOW PORTB.5
return
SEND_SMS4:
HIGH PORTB.6
HSEROUT ["at+cmgs=",34,"0718623462",34,13]
HSEROUT ["unit ,3, Synchronise",26]
HSERIN 15000, BEGIN, [WAIT("OK")]
HSEROUT ["at+cmgs=",34,"0715354064",34,13]
HSEROUT ["unit ,3, Synchronise",26]
HSERIN 15000, BEGIN, [WAIT("OK")]
HSEROUT ["at+cmgs=",34,"0712537063",34,13]
HSEROUT ["unit ,3, Synchronise",26]
HSERIN 15000, BEGIN, [WAIT("OK")]
LOW PORTB.6
return
SEND_SMS5:
HIGH PORTB.6
HSEROUT ["at+cmgs=",34,"0718623462",34,13]
HSEROUT ["unit,3,triped",26]
HSERIN 15000, BEGIN, [WAIT("OK")]
HSEROUT ["at+cmgs=",34,"0715354064",34,13]
HSEROUT ["unit,3,triped",26]
HSERIN 15000, BEGIN, [WAIT("OK")]
HSEROUT ["at+cmgs=",34,"0712537063",34,13]
HSEROUT ["unit,3,triped",26]
HSERIN 15000, BEGIN, [WAIT("OK")]
LOW PORTB.6
return
end
Attached Files

Big thank you to TABSoft

$
0
0
Guys, I just wanted to let you guys into a little secret. TabSoft has been assisting me in upgrading an old project, both on the board, and more often, off board via e-mail.

Without his help and guidance the project would not have gotten as far as it has, and the prototype would not be ready for installation this early. Not only did he educate me more on the inner workings of PBP and how it does things with i2c, serial etc, he also helped me get to grips with liberty basic to produce a PC application to use with the hardware. He did this out of pure good will, and even though we are on opposite sides of the pond we would correspond to the early hours in order to resolve an issue.

I would therefore like to give TABSoft a big public thank you... It's people like you that make learning PBP and messing with electronics fun. You are 'da man bro !!

WDT times not as expected 18f46k80

$
0
0
hi guys i am trying to find why the WDT timeout is not as i am expecting

as i understand it the WDT sends a 4ms pulse originated from the 31Khz osc to the post scaler and gives 4ms x postscaller when the sleep is set

i have set it up for 4ms x 16384 = 65.53 sec , but its triggering at @ 93sec

wondering what may be the problem as i am sure the osc is set correctly to use the LF-INTOSLFO

Code:

;----- CONFIG1L Options --------------------------------------------------
    CONFIG XINST    = OFF
    CONFIG SOSCSEL  = DIG        ; Digital (SCLKI) mode; I/O port functionality of RC0 and RC1 is enabled
    CONFIG INTOSCSEL = LOW        ; LF-INTOSC in low-power mode during Sleep
    CONFIG RETEN    = ON        ; Ultra Low power regulator is Enabled  (Controlled by SRETEN bit)when in sleep  WDTCON.4)

;----- CONFIG1H Options --------------------------------------------------
    CONFIG IESO      = OFF
    CONFIG FCMEN    = OFF
    CONFIG PLLCFG    = OFF
    CONFIG FOSC      = INTIO2    ; Internal RC oscillator  , PORTA.6 , PORTA.7 as I/O
 
;----- CONFIG2L Options --------------------------------------------------
    CONFIG BORPWR    = ZPBORMV    ; ZPBORMV instead of BORMV is selected
    CONFIG BORV      = 2          ; 2V
    CONFIG BOREN    = SBORDIS    ; Enabled in hardware, SBOREN disabled
    CONFIG PWRTEN    = OFF

;----- CONFIG2H Options --------------------------------------------------
    CONFIG  WDTPS    = 16384      ; 1:32768  = 4ms x 32768 =  aprox 139 sec for watchdog timeout
    CONFIG  WDTEN    = SWDTDIS    ; WDT enabled in hardware; SWDTEN bit disabled
 
;----- CONFIG3L Options --------------------------------------------------
; no register in the device

;----- CONFIG3H Options --------------------------------------------------
    CONFIG MCLRE    = ON        ; MCLR ENabled FOR DIAG , RG5 DISabled
    CONFIG MSSPMSK  = MSK7      ; 7 Bit address masking mode
    CONFIG CANMX    = PORTB      ; ECAN TX and RX pins are located on RB2 and RB3, respectively

;----- CONFIG4L Options --------------------------------------------------
    CONFIG BBSIZ    = BB1K      ; 1K word Boot Block size
    CONFIG STVREN    = ON

;----- CONFIG5L Options -------------------------------------------------- 
   
    CONFIG CP0      = ON        ;  MEMORY BLOCK 0 CODE PROTECT BIT - 7KW 800h  - 3FFFh ( when 1K BOOT OPTION used )
    CONFIG CP1      = ON        ;  MEMORY BLOCK 1 CODE PROTECT BIT - 8KW 4000h - 7FFFh
    CONFIG CP2      = ON        ;  MEMORY BLOCK 2 CODE PROTECT BIT - 8KW 8000h - BFFFh
    CONFIG CP3      = ON        ;  MEMORY BLOCK 3 CODE PROTECT BIT - 8KW C000h - FFFFh
 
 
;----- CONFIG5H Options -------------------------------------------------- 
  CONFIG  CPD      = OFF        ; EEPROM DATA PREOTECT BIT - EXTERNAL R/W
  CONFIG  CPB      = ON        ; BOOT BLOCK CODE PROTECT BIT

;----- CONFIG6L Options -------------------------------------------------- 
    CONFIG WRT0      = OFF        ; MEMORY BLOCK WRITE PROTECT BIT
    CONFIG WRT1      = OFF
    CONFIG WRT2      = OFF
    CONFIG WRT3      = OFF
 
 
;----- CONFIG6H Options -------------------------------------------------- 
    CONFIG WRTD      = OFF      ; EEPROM WRITE PROTECT BIT - INTERNAL AND EXTERNAL
    CONFIG WRTB      = ON        ; BOOT BLOCK WRITE PROTECT
    CONFIG WRTC      = ON        ; CONFIGURATION REGISTER WRITE PROTECT BIT
 
;----- CONFIG7L Options -------------------------------------------------- 
    CONFIG EBTR0    = OFF      ; MEMORY READ TABLE BLOCK PROTECT
    CONFIG EBTR1    = OFF
    CONFIG EBTR2    = OFF
    CONFIG EBTR3    = OFF
   
;----- CONFIG7H Options -------------------------------------------------- 
    CONFIG EBTRB    = OFF      ; TABLE READ PROTECT BOOT

Code:


 '----------- 18F46K80  - PIC chip Dephalt settings --------------------
 
 
  OSCCON  = %00110000    ' Select 1Mhz - using 1Mhz internal with PPLx4 in Config1H<3:0>  =  IDLEN =0 , 8Mhz , OSTS=0,RFIOFS=1,RC_Run (1x) OSC using PLL 
                            ' Bit 7 IDLEN =0 ( sleep mode when sleep instraction executed)
                            ' Bits 6-4 -  111 = 16Mhz , 110 = 8MHz ,101 = 4 MHz, 100 = 2MHz 011 = 1MHz
                            ' If INTTSRC=0 and MFIOSEL= 0 then 010 = HF-INTOSC/32 (500Khz), 001 = HF-INTOSC/64 (250Khz) ,000 = LF-INTOSC    (31.25Khz)
                            ' If INTTSRC=0 and MFIOSEL= 1 then 010 = MF-INTOSC    (500Khz), 001 = MF-INTOSC/2  (250Khz) ,000 = LF-INTOSC    (31.25Khz)
                            ' If INTTSRC=1 and MFIOSEL= 0 then 010 = HF-INTOSC/32 (500Khz), 001 = HF-INTOSC/64 (250Khz) ,000 = HF-INTOSC/512 (31.25Khz)
                            ' If INTTSRC=1 and MFIOSEL= 1 then 010 = MF-INTOSC    (500Khz), 001 = MF-INTOSC/2  (250Khz) ,000 = MF-INTOSC/16  (31.25Khz)
                            ' Note: INTSRC = OSCTUNE<7> and MFIOSEL = OSCCON2<0>
                            ' Bit 3 - OSTS = 0 - Osc startup time out  is ruinning from internal OSC ( HF, MF or -INTOSLFC)
                            ' Bit 2 - HFIOFS =1 ( INTOSC Frq stable bit  -  1 = stable , 0 = not stable
                            ' Bits 1-0 - 00= Dephalt Pri OSc ( OSC1/2 or HF-INTOSC with/without PLL set in FOSC,3:0> config1H <3.0>
                            '            01 = SOSC osc
                            '            1x = Internal osc ( LF, MF,HF-INTOSC) 
 
  ' OSCCON2 = $00            ' Bit 7 n/a , Bit 6 - SOSCRUN - Run status bit , Bit 5-4 n/a,
                            ' Bit 3 = SOASCGO - Osc Start control bit 1 = OSC running , 0 = OSC shut off if no requests for it
                            ' Bit 2 n/a , Bit 1 - MFIOFS 1= MFINTOSC stable  0 = Not stable
                            ' Bit 0 MFIOSEL - 1 = MF-INTOSC replaces HF-ISTOSC Freq for 500Khz,250Khz,31.25KHz) 0 = MF-INTOSC not used
 
  OSCTUNE = %00000000      ' Bit 7  - INTSRC - internal LF Source Select 1 = 31.25 from 16Mhz Internal /512 HF-INTOSC ) 0 = Internal 31khz OSC
                            ' Bit 6 - PLLEN - 1 PLL enabled  , 0 = PLL disabled
                            ' Bits 5-0 Frequancy callibaration 00000 = centre Frq
                           
  WDTCON = %00010000      ' use ultra low power mode when in sleep - disable  regulator in sleep mode 
                            ' Bit7 = REGSLP- Regulator Voltage Sleep Enable - 1= Reg goes into low-power Mode when in sleep mode ,0 = Reg stay in normal mode
                            ' Bit6= n/a , Bit5 = ULPLVL - Ultra lowpower Wakeup output sel 1= Vout on RA0 0= Vout on RA1 ( no effect if WDTEN in config is set  )
                            ' Bit4= SRETEN = Regulator Volt Sleep Disable bit - 1= goes into Ultra lOwpower mode in sleep ( CONFIG1L.0 =0 MUST BE SET)
                            ' Bit3=n/a , Bit2 = ULPEN - Ultra Low Power Wakup Module enable 1 = enabled , 0 = disabled
                            ' Bit1=ULPSINK- Ultra Low-power Wakeup Current Sink Enable  1= Sink enabled 0 = Sink disabled ( Not valid if ULPEN=0 )
                            ' Bit0= SWDTEN -Watchdog Timer Enable  = 1= enable watchdog 0 = Disable Watchdog ( no effect if WDTEN in config is set  )

Emulating SPI rom with PICbasic pro?

$
0
0
Hello.

I want to emulate SPI rom with PIC, to test various things. The original device works as follows - on power up, it is queried and 32 bytes read. I know that we can work with SHIFTOUT do represent PIC as SPI slave, but how to start sequence? i.e. if I just put corresponding SHIFTOUT statement into loop, it will transmit automatically when CS pin will be active and clock signal applied to clock pin?

Simulation newbie, any pointers?

$
0
0
Hi, can anyone give me a jumpstart primer on doing simulation for PBP3 ?
i downloaded the OshOnSoft PIC16 IDE eval and gave it a very quick spin, modified a real program to run to a certain early point and set some pins to HIGH and then END
then i loaded the HEX file, ran the sim ultimate speed and saw the pins set at the END, pretty awesome and useful

but of course what i want is to (in simulation) run to a break point and inspect values of variables, i.e. i higher level sim

will either the Osh or Proteus do that with PBP3 source ? it does not seem like it
if not i guess the ASM could be a step in that direction ?
the OshOnSoft pricing is quite reasonable but the single computer license is a killer for my workflow, the Proteus is quite a bit more money but could well pay for itself if i could do some of above, haven't looked at their licensing scheme yet

any tips or guidance much appreciated

Here is how I use an ESP8266 with PushingBox and ThingSpeak services

$
0
0
Hi group!


Here is how I use an ESP8266 with PBP. In the attached example I show you how to use PushingBox and ThingSpeak services. I'm sorry it's not a full working project.
This example suppose you know how to use Darrel's DT_INTS-18.

I'm using a PIC18F25K22 @64MHz. A clock that fast may not be required, it's yours to test it out! You must use a PIC18 because a big receiving buffer is required. It's a matter of memory banks.
There a lot of hserout2 for debugging purposes. There is no handling of any HTTP response, sorry!


Watch out: The ESP8266 works @3V. You need a level shifter on the RX & reset pins of the ESP, a resistor divider is enough. The TX of the ESP can drive the RX on the PIC without level shifting.


This is how to push data to ThingSpeak (here 3 fields with values 5, 255 & 300):


Code:

GET /update?key={my_API_key}&field1=5&field2=255&field3=300&headers=false HTTP/1.1{CrLf}Host: api.thingspeak.com{CrLf}Connection: close{CrLf}Accept: */*{CrLf}{CrLf}
  • Replace {CrLf} by CrLf ( 13, 10 )
  • Replace {my_API_key} with your API key
  • The keyword "headers=false" will remove extra headers from response.
  • The keyword "Connection: close" will close the connection automatically.
See ThingSpeak doc for more. Note: ThingSpeak is limitted to one call every 15 seconds max.


PushingBox is nice to push to several services (email, Twitter) in a single call. Note: strings must be URL encoded. Here is an online tool: http://meyerweb.com/eric/tools/dencoder/
For my lawn mower project I'm using an external I2C EEPROM to store my URL encoded tweets. The data is URL encoded and dumped using VB.NET:


Code:

Dim UrlEncoded As String = System.Web.HttpUtility.UrlEncode(MyString)
Debug.WriteLine(UrlEncoded)



Without Darrel's work a LOT of projects wouldn't exists. Thank you and RIP Darrel...


Attachment 7927
Attachment 7928
Attached Files

SSD1306 Include example

$
0
0
Just finished an Include for the SSD1306 mono graphics display. No graphics just text. Best part is that it fits within a 4K chip. Tested on 2 different displays. If you can't get it to work I would suggest making sure you get random bits after the SSD_Init is finished. If you don't see random bits, either your I2C is wrong or you need to spend more time tweaking the SSD_Init. In my case one display refuses to work with a charge pump the other one requires it.

Regards
TimC

Code:

'SSD 1306 Sample
'==========================MCU SETUP============================================
DEFINE OSC 20
'OPTION_REG=0 'only for 16F877A
ADCON0=0
ADCON1=7

Include "N:\PIC\PicBasicPro\include\SSD1306.inc"  ' bring it in

'==========================    MAIN  Routine    ==============================
temp var byte

gosub SSD_Init
looper:

arraywrite SSD_BUFF,[0,0,"Line 0",0] : gosub SSD_PRINTXY
arraywrite SSD_BUFF,[" and more",0] : gosub SSD_PRINT        ' continue on same line

arraywrite SSD_BUFF,[30,1,"Middle 1",0] : gosub SSD_PRINTXY
arraywrite SSD_BUFF,[10,2,"Here we are Line 2",0] : gosub SSD_PRINTXY
random temp                ' jumps about
'temp = 76
arraywrite SSD_BUFF,[0,3,"Current Temp=",dec2 temp, "deg" ,0] : gosub SSD_PRINTXY

arraywrite SSD_BUFF,[20,5,"Hip Hop Hi Ho 5",0] : gosub SSD_PRINTXY
arraywrite SSD_BUFF,[10,6,"|%+-./\<=>_    6",0] : gosub SSD_PRINTXY
arraywrite SSD_BUFF,[10,7,"{}[]!@#$%^&*()  7",0] : gosub SSD_PRINTXY

sleep 5
GOTO looper
END

Now The Include

Code:

'This code is for driving an OLED screen

'Typical screen is 0.96" 128x64 mono SSD1306 chip with I2C protocol
'This code has a large char library in it, so it takes some space, you may
'delete the top and bottom tables if you need more space for your program but
'you will need to rewrite the logic.
'No bitmap drawing! Only intended to write text on screen.
'
'Screen contains 8 lines (which are 8 pixel height) and 128 columns

' Typical way to print a formatted line to the DDS1306 Display is like this:
' arraywrite SSD_BUFF,[0,3,"Current Temp=",dec2 temp, "deg" ,0] : gosub SSD_PRINTXY
' 0= Column in pixels
' 3= Row to print on
' Last 0 is necessary and to terminate the string to print

' Public variables and Functions are in the Format SSD_AAAAAA
' Private variables and Functions look like SSD_i_AAAAA

'===================  SSD1306  ADDRESS  AND CONSTANTS  ========================
SSD_i_Device CON $78      ' Normally $78
SSD_i_DeviceCommand        CON        $00
SSD_i_DataCommand        CON        $40
'=========================  SSD Variables  ==================================
SCL var PortC.3        ' I2C Clock  PortC.3  move if using more than one I2C device
SDA var PortC.4        ' I2C Data  PortC.4  move if using more than one I2C device
SSD_BUFF VAR BYTE[27]        ' pass through to Display
SSD_i_Byte2Send                VAR BYTE        ' Prepared byte to be sent to Display
SSD_i_Byte2Send2        VAR BYTE        ' Prepared Byte to be sent to Display

SSD_i_Column VAR BYTE' LCD Column POSITION (0 TO 127)
SSD_i_Row VAR BYTE'LCD Line POSITION FOR PAGE MODE(0 TO 7)

SSD_i_CharIndex var word 'Char codes index
SSD_i_CharIndexT var byte 'char codes index temp
SSD_i_OffsetTemp var byte        ' calculating offset into tables

SSD_i_StringWork var byte 'index for text
SSD_i_Char2send var byte 'data carrier for text chars

goto SSD1306_i_Around        ' this is an add-in so go around

'====================  SSD1306 initialization  ===============================
SSD_Init:
pause 10
SSD_i_Byte2Send=$AE:GOSUB SSD_i_SendCommand 'Display OFF
SSD_i_Byte2Send=$D3:SSD_i_Byte2Send2=$00:GOSUB SSD_i_SendCommand2 ' Set offset to 0
'SSD_i_Byte2Send=$40:GOSUB SSD_i_SendCommand ' Set display start line 0, usually not needed
SSD_i_Byte2Send=$8D:SSD_i_Byte2Send2=$14:GOSUB SSD_i_SendCommand2 ' Set Charge Pump Internal, usually needed
SSD_i_Byte2Send=$20:SSD_i_Byte2Send2=$10:GOSUB SSD_i_SendCommand2 ' Adressing mode $10=Page, $00=Horizontal
SSD_i_Byte2Send=$A1:GOSUB SSD_i_SendCommand        ' set segment remap column 127 as start
SSD_i_Byte2Send=$C8:GOSUB SSD_i_SendCommand ' Com Scan Direction, Flip display vertically
SSD_i_Byte2Send=$DA:SSD_i_Byte2Send2=$12:GOSUB SSD_i_SendCommand2 ' set COM pins = 128x64=$12  128x32=$02
SSD_i_Byte2Send=$81:SSD_i_Byte2Send2=$7F:GOSUB SSD_i_SendCommand2 ' Set contrast to $01 to $FF  ($7F is default, $01 is faint)
SSD_i_Byte2Send=$A4:GOSUB SSD_i_SendCommand ' display ON continue
SSD_i_Byte2Send=$A6:GOSUB SSD_i_SendCommand ' $A6=NORMAL MODE;  $A7=INVERSE MODE
SSD_i_Byte2Send=$AF:GOSUB SSD_i_SendCommand 'Display ON
pause 500        '  look for random bytes. Remove if you would like
GOSUB SSD_Clear
return
'======================Print Lines==============================================
SSD_Print:
SSD_i_StringWork = 0        ' set index to beginning
DO while SSD_BUFF[SSD_i_StringWork] <> 0
        SSD_i_Char2send = SSD_BUFF[SSD_i_StringWork]        ' pull letter out of array
        gosub SSD_i_BuildChar                ' Build char and send out
        SSD_i_StringWork = SSD_i_StringWork + 1                ' point to next char
loop
return

SSD_PrintXY:
SSD_i_Column=SSD_BUFF[0]  ' Column in first position
SSD_i_Row=SSD_BUFF[1]  ' Row in second
gosub SSD_i_SetXY                ' set cursor position
SSD_i_StringWork = 2                        ' now point to first character to print
DO while SSD_BUFF[SSD_i_StringWork] <> 0
        SSD_i_Char2send = SSD_BUFF[SSD_i_StringWork]
        gosub SSD_i_BuildChar
        SSD_i_StringWork = SSD_i_StringWork + 1
loop
return

'=====================  Send data  =============================================
SSD_i_SendData:
I2CWrite SDA,SCL,SSD_i_Device,[SSD_i_DataCommand,SSD_i_Byte2Send]
RETURN
'====================  Send Command  ===========================================
SSD_i_SendCommand:
I2CWrite SDA,SCL,SSD_i_Device,[SSD_i_DeviceCommand,SSD_i_Byte2Send]
RETURN
'====================  Send Command  ===========================================
SSD_i_SendCommand2:
I2CWrite SDA,SCL,SSD_i_Device,[SSD_i_DeviceCommand, SSD_i_Byte2Send, SSD_i_Byte2Send2]
RETURN
'============================== clear ========================================
SSD_Clear:
SSD_i_Column=0
'SSD_i_Row=0
FOR SSD_i_Row=0 TO 7
    gosub SSD_i_SetXY
    FOR SSD_i_OffsetTemp=0 TO 127
            I2CWrite SDA,SCL,SSD_i_Device,[SSD_i_DataCommand,0]        'Send 0 to every column in every line
        'GOSUB SSD_i_SendData
    NEXT SSD_i_OffsetTemp
NEXT SSD_i_Row
SSD_i_Column=0 : SSD_i_Row=0 : gosub SSD_i_SetXY        ' Go Home
RETURN
'===========================================SET X AND Y=========================
SSD_i_SetXY:
SSD_i_Byte2Send=$21:GOSUB SSD_i_SendCommand
SSD_i_Byte2Send=SSD_i_Column:GOSUB SSD_i_SendCommand
SSD_i_Byte2Send=127:GOSUB SSD_i_SendCommand
'Above 3 lines means; Column starts at SSD_i_Column and End at 127
SSD_i_Byte2Send=$22:GOSUB SSD_i_SendCommand
SSD_i_Byte2Send=SSD_i_Row:GOSUB SSD_i_SendCommand
SSD_i_Byte2Send=SSD_i_Row:GOSUB SSD_i_SendCommand
'Above 3 lines means; Line starts at SSD_i_Row and end at SSD_i_Row,
'which means ; Only work on specified line!
RETURN
'===================== Build Character and Send=====================================
SSD_i_BuildChar:
' Enter this Subroutine with printable character: SSD_i_Char2send
' SSD_i_Char2send is subtracted from " " (space char) and * by 5 to be able to index into one table
' One table is broken into 3 to avoid the 255 max.  Index into table must be a byte variable.

        SSD_i_OffsetTemp = SSD_i_Char2send - 32        ' Space is now at index 0 all other characters are 32 less into index
        SSD_i_OffsetTemp = SSD_i_OffsetTemp * 5        ' Every character is made of 5 bytes
    for SSD_i_CharIndex=SSD_i_OffsetTemp to SSD_i_OffsetTemp+4
        IF SSD_i_Char2send < "A" then
        SSD_i_CharIndexT = SSD_i_CharIndex - 0        ' lookup variable must be 8 bits
    lookup SSD_i_CharIndexT,[$00,$00,$00,$00,$00,$00,$00,$5F,$00,$00,$00,$07,$00,$07,$00,$14,$7F,$14,$7F,$14,_        'sp,!,",#
                                        $24,$2A,$7F,$2A,$12,$23,$13,$08,$64,$62,$36,$49,$56,$20,$50,_        '$,%,&
                                        $00,$08,$07,$03,$00,$00,$1C,$22,$41,$00,$00,$41,$22,$1C,$00,_        '',(,)
                                        $2A,$1C,$7F,$1C,$2A,$08,$08,$3E,$08,$08,$00,$00,$70,$30,$00,_        '*,+,,
                                        $08,$08,$08,$08,$08,$00,$00,$60,$60,$00,$20,$10,$08,$04,$02,_        '-,.,/
                                        $3E,$51,$49,$45,$3E,$00,$42,$7F,$40,$00,$72,$49,$49,$49,$46,_        '0,1,2
                                        $21,$41,$49,$4D,$33,$18,$14,$12,$7F,$10,$27,$45,$45,$45,$39,_        '3,4,5
                                        $3C,$4A,$49,$49,$31,$41,$21,$11,$09,$07,$36,$49,$49,$49,$36,_        '6,7,8
                                        $46,$49,$49,$29,$1E,$00,$00,$14,$00,$00,$00,$40,$34,$00,$00,_        '9,:,;
                                        $00,$08,$14,$22,$41,$14,$14,$14,$14,$14,$00,$41,$22,$14,$08,_        '<,=,>
                                        $02,$01,$59,$09,$06,$3E,$41,$5D,$59,$4E],SSD_i_Byte2Send        '?,@
        elseif  (SSD_i_Char2send < "[") then
        SSD_i_CharIndexT = SSD_i_CharIndex - 165                ' subtract previous table length so "A" = zero
        lookup SSD_i_CharIndexT,[$7C,$12,$11,$12,$7C,_        'A
                                        $7F,$49,$49,$49,$36,$3E,$41,$41,$41,$22,$7F,$41,$41,$41,$3E,_        'B,C,D
                                        $7F,$49,$49,$49,$41,$7F,$09,$09,$09,$01,$3E,$41,$41,$51,$73,_        'E,F,G
                                        $7F,$08,$08,$08,$7F,$00,$41,$7F,$41,$00,$20,$40,$41,$3F,$01,_        'H,I,J
                                        $7F,$08,$14,$22,$41,$7F,$40,$40,$40,$40,$7F,$02,$1C,$02,$7F,_        'K,L,M
                                        $7F,$04,$08,$10,$7F,$3E,$41,$41,$41,$3E,$7F,$09,$09,$09,$06,_        'N,O,P
                                        $3E,$41,$51,$21,$5E,$7F,$09,$19,$29,$46,$26,$49,$49,$49,$32,_        'Q,R,S
                                        $03,$01,$7F,$01,$03,$3F,$40,$40,$40,$3F,$1F,$20,$40,$20,$1F,_        'T,U,V
                                        $3F,$40,$38,$40,$3F,$63,$14,$08,$14,$63,$03,$04,$78,$04,$03,_        'W,X,Y
                                        $61,$59,$49,$4D,$43],SSD_i_Byte2Send        'Z
        else
        SSD_i_CharIndexT = SSD_i_CharIndex - 295                ' subtract previous tables length so "[" = zero
        lookup SSD_i_CharIndexT,[$00,$7F,$41,$41,$41,$02,$04,$08,$10,$20,_        '[,\
                                        $00,$41,$41,$41,$7F,$04,$02,$01,$02,$04,$40,$40,$40,$40,$40,_        '],^,_
                                        $00,$03,$07,$08,$00,$20,$54,$54,$38,$40,$7F,$28,$44,$44,$38,_        '`,a,b
                                        $38,$44,$44,$44,$28,$38,$44,$44,$28,$7F,$38,$54,$54,$54,$18,_        'c,d,e
                                        $00,$08,$7E,$09,$02,$0C,$52,$52,$4A,$3C,$7F,$08,$04,$04,$78,_        'f,g,h
                                        $00,$44,$7D,$40,$00,$20,$40,$40,$3D,$00,$7F,$10,$28,$44,$00,_        'i,j,k
                                        $00,$41,$7F,$40,$00,$7C,$04,$78,$04,$78,$7C,$08,$04,$04,$78,_        'l,m,n
                                        $38,$44,$44,$44,$38,$7C,$18,$24,$24,$18,$18,$24,$24,$18,$7C,_        'o,p,q
                                        $7C,$08,$04,$04,$08,$48,$54,$54,$54,$24,$04,$04,$3F,$44,$24,_        'r,s,t
                                        $3C,$40,$40,$20,$7C,$1C,$20,$40,$20,$1C,$3C,$40,$30,$40,$3C,_        'u,v,w
                                        $44,$28,$10,$28,$44,$4C,$50,$50,$50,$3C,$44,$64,$54,$4C,$44,_        'x,y,z
                                        $00,$08,$36,$41,$00,$00,$00,$77,$00,$00,$00,$41,$36,$08,$00,_        '{,|,}
                                        $02,$01,$02,$04,$02],SSD_i_Byte2Send        '~
        endif
    gosub SSD_i_SendData
    next SSD_i_CharIndex
        SSD_i_Byte2Send = $00                ' space between characters always $00
    gosub SSD_i_SendData
        return
'===============================================================================
SSD1306_i_Around:

Viewing all 4745 articles
Browse latest View live