View previous topic :: View next topic |
Author |
Message |
marcomilazzo
Joined: 12 Oct 2005 Posts: 19
|
Posted: Tue May 08, 2012 3:42 pm Post subject: software baud rate |
|
|
hi
is there a way to change the sw baud rate in the code?
thank's
marco |
|
Back to top |
|
|
Luciano
Joined: 29 Nov 2004 Posts: 3149 Location: Italy
|
Posted: Tue May 08, 2012 5:59 pm Post subject: |
|
|
Hi,
See Bascom Help "SEROUT".
Best regards,
Luciano |
|
Back to top |
|
|
marcomilazzo
Joined: 12 Oct 2005 Posts: 19
|
Posted: Tue May 08, 2012 10:39 pm Post subject: |
|
|
hi
thanks for the answer!
great
but what about using inputbin # etc...
ciao
marco |
|
Back to top |
|
|
Paulvk
Joined: 28 Jul 2006 Posts: 1257 Location: SYDNEY
|
Posted: Tue May 08, 2012 11:49 pm Post subject: |
|
|
Hello Marco
Have a look at the blog section ENC28J60 webserver I have a sub in there that changes the baud rate with user input and loads its default from EEPROM.
Regards Paul |
|
Back to top |
|
|
marcomilazzo
Joined: 12 Oct 2005 Posts: 19
|
Posted: Wed May 09, 2012 11:41 am Post subject: |
|
|
hi Paul
thank' for the help
my problem is to change the sw baud rate e not the hw one
i didn't have time to try something yet
i'm comunicating at 600 baud with a cs5490 , a power meter
and i'm using one attiny861 with no uart
it was on the shell
unfortunateky i got a problem with the inputbin statment that doesn't work at 8MHz!!
it work's only with a crystal at 16 MHz!!!
the cs5490 can work also at a higher speed but it must be programmed at 600 baud
so i shall program at first at 600 e then switch to 9600
every time it resets it goes to 600 baud
ciao
Open "comb.3:600,8,n,1" For Output As #3
Open "comb.2:600,8,n,1" For Input As #4
Do
Print #3 , Chr(128) ; Chr(0) ; 'command
Inputbin #4 , R , R1 , R2 'answeer from the cs5490
Print #1 , R
Print #1 , R1
Print #1 , R2
Waitms 100
Loop |
|
Back to top |
|
|
Luciano
Joined: 29 Nov 2004 Posts: 3149 Location: Italy
|
Posted: Wed May 09, 2012 10:05 pm Post subject: |
|
|
Hi,
See Bascom Help "SEROUT" and "SERIN".
Use an array of bytes for the parameter "var".
* * *
Make sure you put the $CRYSTAL directive in your program:
* * *
While you are receiving the data, nothing else can be done
with the microcontroller because a SW UART uses bit-banging.
Best regards,
Luciano |
|
Back to top |
|
|
marcomilazzo
Joined: 12 Oct 2005 Posts: 19
|
Posted: Thu May 10, 2012 6:08 pm Post subject: |
|
|
ciao Luciano
italian? like me?
serout is fine .but what about using the inputbin statment?
ciao
marco |
|
Back to top |
|
|
Luciano
Joined: 29 Nov 2004 Posts: 3149 Location: Italy
|
Posted: Thu May 10, 2012 6:17 pm Post subject: |
|
|
Ciao Marco,
Use "SERIN" and an array of bytes for its parameter "var".
If you use an array of bytes you can receive any value from 0 to 255. (Binary data).
With "SEROUT" and "SERIN" you will be able to change the baud rate at run-time.
Best regards,
Luciano |
|
Back to top |
|
|
|