Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Sending BGF Files via TX Pin ?

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
MichaelB.

Bascom Member



Joined: 04 May 2017
Posts: 58

germany.gif
PostPosted: Wed Jul 24, 2019 3:10 pm    Post subject: Sending BGF Files via TX Pin ? Reply with quote

Hello everyone,

I search for a way to Send the Data from a BGF file , via a RF Module, to a another Chip with a Display (witch can show the BGF file).
But i dont know where the BGF Pictures a Stored in the Memory.
I tryed this: Laughing

Code:
Print $Bgf "MenuRegistredDevice.bgf"


But it Prints exactly this, and not the Data of the Picture. :/
It have to kinda like SHOWPIC to get the Data of the Picture from the Memory and shows it.

But i want to get the Data of the Picture from the Memory and PRINT it. Maybe like PRINTPIC. Very Happy

Had someone a clue or a trick for this? Embarassed

(BASCOM-AVR version : 2.0.8.1 )
Back to top
View user's profile
EDC

Bascom Expert



Joined: 26 Mar 2014
Posts: 971

poland.gif
PostPosted: Wed Jul 24, 2019 3:35 pm    Post subject: Reply with quote

Interesting idea Very Happy

I think you must check "Properties" of the needed BGF file in Windows Explorator to know EXACTLY how many bytes this BGF have.
Then, for example, if this file have 200 bytes code below shoud do the trick Very Happy
Code:
$regfile = "m328pdef.dat"
$crystal = 4000000
$hwstack = 64
$swstack = 16
$framesize = 64
$baud = 115200

Dim Helpb As Byte , Helpw As Word


Restore Picture
For Helpw = 1 To 200
 Read Helpb
 Print Helpb
Next

End

Picture:
$bgf "myBgf.bgf"
 

This showing idea only and can be optimised for efficiency.
Back to top
View user's profile Visit poster's website
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5921
Location: Holland

blank.gif
PostPosted: Wed Jul 24, 2019 7:06 pm    Post subject: Reply with quote

instead of using $bgf, have a look at $INC which can binary include a file with a label and size.
sending can be done with printbin or when using print make sure you use : print chr(ar(x));
thus chr() function to send as binary, and ; to suppress CR + LF

then you need to alter the driver for the lcd. instead of getting it from eeprom or ram, use waitkey()

_________________
Mark
Back to top
View user's profile Visit poster's website
MichaelB.

Bascom Member



Joined: 04 May 2017
Posts: 58

germany.gif
PostPosted: Wed Jul 24, 2019 7:24 pm    Post subject: Reply with quote

EDC wrote:
Interesting idea Very Happy

I think you must check "Properties" of the needed BGF file in Windows Explorator to know EXACTLY how many bytes this BGF have.
Then, for example, if this file have 200 bytes code below shoud do the trick Very Happy
Code:
$regfile = "m328pdef.dat"
$crystal = 4000000
$hwstack = 64
$swstack = 16
$framesize = 64
$baud = 115200

Dim Helpb As Byte , Helpw As Word


Restore Picture
For Helpw = 1 To 200
 Read Helpb
 Print Helpb
Next

End

Picture:
$bgf "myBgf.bgf"
 

This showing idea only and can be optimised for efficiency.




Thank you for the fast reply.
This Works basicly but, the Transmitted data makes no sense.
I have send a Testpicture to understand the incomming data pakets.
It is just a Complete Black 8x8 Picture and takes 6 Byte. I changed you FOR loop from 200 to 10. Just to see what he send with nothing. Confused

The Recieving MCU use: DataInput as String*20
Code:
Input DataInput Noecho

And it shows:
69 59 62 42 55 70 70 55 0 0
so this might be ASCII values.

but not what i expected, like 255 255 255 255 255 255 0 0 0 0 Crying or Very sad
Back to top
View user's profile
MichaelB.

Bascom Member



Joined: 04 May 2017
Posts: 58

germany.gif
PostPosted: Wed Jul 24, 2019 7:40 pm    Post subject: Reply with quote

albertsm wrote:
instead of using $bgf, have a look at $INC which can binary include a file with a label and size.
sending can be done with printbin or when using print make sure you use : print chr(ar(x));
thus chr() function to send as binary, and ; to suppress CR + LF

then you need to alter the driver for the lcd. instead of getting it from eeprom or ram, use waitkey()



Sounds very good too. Smile
This will take me to the next question.
Now when i Save the incomming Data from the Picture, how can i use SHOWPIC from a Custom Memory location? How does it look like?
Like:
SHOWPIC 0 , 0 , &h00 to &h006 ' ?
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5921
Location: Holland

blank.gif
PostPosted: Wed Jul 24, 2019 8:08 pm    Post subject: Reply with quote

please read the help. there is no option to show from a custom location. and this is a for a reason : you dont have enough space to store the picture in memory.
_________________
Mark
Back to top
View user's profile Visit poster's website
MichaelB.

Bascom Member



Joined: 04 May 2017
Posts: 58

germany.gif
PostPosted: Wed Jul 24, 2019 8:52 pm    Post subject: Reply with quote

albertsm wrote:
please read the help. there is no option to show from a custom location. and this is a for a reason : you dont have enough space to store the picture in memory.


Hi albertsm
i read the help, this is why i am here.

albertsm wrote:
there is no option to show from a custom location

Can you make a Language Statement like:

SAVE ByteIncomingPicture(6) as BGF at &h268!4OW3ß8 ?
TestPicture = &h268!4OW3ß8
SHOWPIC 0 , 0 , Testpicture

This would be awesome.
best regards
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5921
Location: Holland

blank.gif
PostPosted: Thu Jul 25, 2019 9:27 am    Post subject: Reply with quote

MichaelB. wrote:


i read the help, this is why i am here.


ok i ask because you ask :
Quote:
Now when i Save the incomming Data from the Picture, how can i use SHOWPIC from a Custom Memory location? How does it look like?
Like:
SHOWPIC 0 , 0 , &h00 to &h006 ' ?

Which is nowhere described in the help.

I already provided a simple method to send a BGF file, or actually any (binary) data you have. $INC can store a label and size. And it is simple to read and send this data. you should try it.
Only the 'other side' is more work. Either alter the lib (i do not know which driver/lcd you use) and receive direct. Or make 2 steps : receive the data. Then show from memory.
I am willing to make a change to support loading from SRAM. But you need to understand that bgf files can be big in size. Depending on LCD and image. If your biggest bgf file is 8KB, you need a buffer of 8 KB !
Most chips do not have that size. So before i do a lot of work : change compiler, drivers, documentation, testing. Make sure that this is usable. I dont want to work on features that are never used.

When using direct com, there is no limit in size since data is sent byte after byte. but you need some handshake to make sure all is kept in sync.

_________________
Mark
Back to top
View user's profile Visit poster's website
MichaelB.

Bascom Member



Joined: 04 May 2017
Posts: 58

germany.gif
PostPosted: Thu Jul 25, 2019 10:17 am    Post subject: Reply with quote

[quote="albertsm"]
MichaelB. wrote:


I am willing to make a change to support loading from SRAM. But you need to understand that bgf files can be big in size. Depending on LCD and image. If your biggest bgf file is 8KB, you need a buffer of 8 KB !
Most chips do not have that size. So before i do a lot of work : change compiler, drivers, documentation, testing. Make sure that this is usable. I dont want to work on features that are never used.

When using direct com, there is no limit in size since data is sent byte after byte. but you need some handshake to make sure all is kept in sync.



This sound awesome.

The Recieving MCU using a E32 TTL100 RF Module:
Code:
$regfile = "m128def.DAT"
$crystal = 7372800
$baud = 19230
$eepleave
'$loadersize = 512
$hwstack = 100
$swstack = 200
$framesize = 200
$Timeout = 100
$lib "glcdKS108.lib"                                        ' KS-108 controler
'$Sim

Config Graphlcd = 128 * 64sed , Dataport = Porta , Controlport = Portc , Ce = 0 , Ce2 = 1 , Cd = 2 , Rd = 3 , Reset = 5 , Enable = 4

Const Serout_extpull = 0
Config Serialout = Buffered , Size = 20
Config Serialin = Buffered , Size = 20
Do
      Bitwait Pine.2 , Set
      Input DataInput Noecho
      ' << and save here the Incomming Picture data to show later with SHOWPIC >>

Loop
End

and an amount BGF Files after the END, that already exist during Compile

Code:
The Sending MCU using a E32 TTL100 RF Module:
$regfile = "m32def.dat"
$crystal = 16000000
$baud = 19230
$hwstack = 30
$swstack = 30
$framesize = 40
$Timeout = 20

Wait 2
Config Lcdbus = 4
Config Lcdpin = Pin , Db4 = Portb.3 , Db5 = Portb.2 , Db6 = Portb.1 , Db7 = Portb.0 , E = Portb.4 , Rs = Portb.5
Config LCD = 16 * 4

Const Serout_extpull = 0
Config Serialin = Buffered , Size = 20
Config Serialout = Buffered , Size = 20

Do
     >> Print BGF <<
Loop
End
 



PS: Certainly i will cost me this a bit, maybe 10 or 20 Euro via Paypal Smile Very Happy
Back to top
View user's profile
six1

Bascom Expert



Joined: 27 Feb 2009
Posts: 553

germany.gif
PostPosted: Thu Jul 25, 2019 10:52 am    Post subject: Reply with quote

Hi Michael,
the above code doesn't really solve anything.
do you want to receive data from bgf file and immediately write it to Display?
otherwise where's your buffer for incoming huge data?


...or did you want someone to supplement your code fragments above?
... which probably will not happen


Very Happy

_________________
For technical reasons, the signature is on the back of this message.
Back to top
View user's profile
MichaelB.

Bascom Member



Joined: 04 May 2017
Posts: 58

germany.gif
PostPosted: Thu Jul 25, 2019 11:55 am    Post subject: Reply with quote

six1 wrote:
Hi Michael,
the above code doesn't really solve anything.
do you want to receive data from bgf file and immediately write it to Display?
otherwise where's your buffer for incoming huge data?


...or did you want someone to supplement your code fragments above?
... which probably will not happen


Very Happy


I want to Recieve a BGF File and want to Store it in the eeprom, and have access when it need to be Shown.

Quote:
where's your buffer for incoming huge data?

What do you mean? Serialin and out are Buffered with the Size of 20. Which i must increase when its nessesary.
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5921
Location: Holland

blank.gif
PostPosted: Thu Jul 25, 2019 12:08 pm    Post subject: Reply with quote

while memory of processor is limited, the EEPROM is certainly limited.
do you already have these bgf files? and what is the byte size of the biggest one?

_________________
Mark
Back to top
View user's profile Visit poster's website
MichaelB.

Bascom Member



Joined: 04 May 2017
Posts: 58

germany.gif
PostPosted: Thu Jul 25, 2019 1:07 pm    Post subject: Reply with quote

albertsm wrote:
while memory of processor is limited, the EEPROM is certainly limited.
do you already have these bgf files? and what is the byte size of the biggest one?


The biggest BGF of my 137 Pictures in my Project have 987 Bytes (this is the MainMenu Picture with a bunch of Details).
The Most of all other ranges from around 50 to 200 Bytes.
I havent done yet some Pixelwork for the Transmitting Picture, because iam working currently on some Idleing Animations with Pset ,until a "Confirmed" String is Recieved.
I can send you a Similar BGF with the same Dimensions of my already using Submenu´s.

The Picture is 64x32 with 238 Bytes

Edit: there is a Permission, i can not tke a BGF in the attachment here.
Back to top
View user's profile
EDC

Bascom Expert



Joined: 26 Mar 2014
Posts: 971

poland.gif
PostPosted: Thu Jul 25, 2019 8:01 pm    Post subject: Reply with quote

When ive read :
MichaleB wrote:
..(witch can show the BGF file)

I was think that you have the receiver side done Very Happy
..and, ofcourse I made mistake in my code. Should be "Printbin" instead "Print". That`s why you see ascii representations of the values.

You must know that BGF must be decompressed by sender and this is some time consuming but spare some flash space.
If you have space in flash then indeed bin file, like Mark propose, will be quicker.
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum