Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Wireless transmission of programs.

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

Bascom Member



Joined: 07 Sep 2010
Posts: 35

PostPosted: Sun Jun 21, 2015 5:40 pm    Post subject: Wireless transmission of programs. Reply with quote

Hi
I have been using blutooth along with a bootloader. To avoid having to use the code in program I use a ATTiny to sniff rx and detects when the 123 will come then puts attinyn a reset pulse and waits until PB3 goes low then then it starts listening efer 123 again. It works, but you can do it more smoothly? I using HC05 as a transmitter and the transmitter operates up to 10 m.
The program

'------------------------------------------------------------------------------
' Reset signal for MCS Bootloader
'------------------------------------------------------------------------------
$regfile = "attiny45.dat"
$prog &HFF , &HD2 , &HDC , &HFF
$crystal = 8000000
$hwstack = 64
$swstack = 64
$framesize = 64
Dim Bstatus As Byte
Const On = 1
Const Off = 0
'Ddrb = &B00011001
Led Alias Pinb.4 'fungerar inte
Res Alias Pinb.3
Ok Alias Pinb.2
Config Led = Output
Config Res = Output
Config Ok = Input
Res = On 'set Res
Led = Off 'Reset Led
Ok = On
Open "comb.1:38400,8,n,1" For Input As #2
'Open "comb.0:38400,8,n,1" For Output As #1
Do
Bstatus = Waitkey(#2) '{ did we received value 123 ?
If Bstatus = 123 Then
Led = On 'Set Led
Res = Off 'Reset Res
Waitms 5
Res = On
Bitwait Ok , Reset
Led = Off 'Reset Led
End If
nop
Loop
End

Maybe there's something smarter way to do this. But it works just fine.
Sincerely Maxneo


(BASCOM-AVR version : 2.0.7.9 , Latest : 2.0.7.8 )
Back to top
View user's profile
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Sun Jun 21, 2015 7:03 pm    Post subject: In and Out mixup Reply with quote

Sorry, but I see some errors in assigning PIN and PORT.

The output should be configured as PORT and the input as PIN.

RES and LED should be outputs, so PORT

Have fun and thanks for sharing
Ben Zijlstra
Back to top
View user's profile Visit poster's website
maxneo

Bascom Member



Joined: 07 Sep 2010
Posts: 35

PostPosted: Sun Jun 21, 2015 7:56 pm    Post subject: Reply with quote

Thanks for the answer because I did not get the alias to work, I used the toggle, but now it works well thanks for your help.

Led Aliases Portb.4 'not working
Res Alias Portb.3
Ok Alias Pinb.2
Config Pinb.2 = Input
Config = Output Led
Config Res = Output
Ok config = Input

Sincerely Max Neo
Back to top
View user's profile
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