Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Total time for PRINT STATEMENT

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Unsupported versions
View previous topic :: View next topic  
Author Message
azny

Bascom Member



Joined: 25 Aug 2008
Posts: 36
Location: usa

usa.gif
PostPosted: Mon Jun 25, 2018 7:51 pm    Post subject: Total time for PRINT STATEMENT Reply with quote

Hello

I am trying to minimize the time required by PRINT statement to print 1 byte of data
Considering a baudrate of 38400, time required to send 10bits of data (1 start bit +8 bit data + 1 stop bit)= 10/38400= 260usec
When I use the Print Command to print 1 byte of data it takes around 785usec/byte
Is there a way where I can reduce this amount of time required to Print a byte and get it close to Ideal scenario (i.e 260usec)
I tried the PUT command but it did not work (if anyone could provide an example that would be great)
Thank you

Code:
$regfile = "M164pdef.dat"
$crystal = 3686400
$baud = 38400
$hwstack = 80
$swstack = 80
$framesize = 80


Config Com2 = 38400 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0

 'use OPEN/CLOSE for using the second UART
Config Serialin1 = Buffered , Size = 32
Open "COM2:" For Binary As #1
Config Print1 = Portd.4 , Mode = Set
Config Portd.4 = Output

Dim C3 As Byte

C3 = 81

 Do

 Print #1 , Chr(c3)

 Loop



[/code]

(BASCOM-AVR version : 2.0.7.5 , Latest : 2.0.8.1 )
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 6197
Location: Holland

blank.gif
PostPosted: Mon Jun 25, 2018 8:10 pm    Post subject: Reply with quote

at some stage it is a good idea to read the manual.
or to search the forum.
what you are missing is that you you send 3 bytes : your data byte, and a CR + LF
To suppress the CR and LF, end the line with ; (semi colon)

_________________
Mark
Back to top
View user's profile Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Unsupported versions 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