Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

how to change source in C for ATmega 8

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> Various
View previous topic :: View next topic  
Author Message
jempie

Bascom Member



Joined: 07 Jun 2010
Posts: 24

blank.gif
PostPosted: Mon May 16, 2011 11:41 am    Post subject: how to change source in C for ATmega 8 Reply with quote

I have the source of an program witch is written in C use for ATmega 8
i thought it only work with bascom but it work also in C
now i want to change the source but i only have AVRISP and the software
can i read the source into AVR studio and make an HEX file.

I'm totally new in programming, but i want to try this

Thanks
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 4970
Location: Holland

blank.gif
PostPosted: Mon May 16, 2011 11:57 am    Post subject: Reply with quote

This forum is not for C projects.
You should know that since this is not your first post.
Try avrfreaks or some winavr forum.
mcselec.com is dedicated to BASIC, not C.
If you need help converting C to BASIC it is ok. But help for C projects is out of scope.

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

Bascom Member



Joined: 07 Jun 2010
Posts: 24

blank.gif
PostPosted: Tue May 24, 2011 12:40 am    Post subject: Reply with quote

Sorry for that.

OK I have an schematic and I want this work bascom
I'm totally new in programming but i want to learn this.

See schematic i now have change this source first step
does i forget something?


******* source***************

$regfile = "m8def.dat" ' specify the used micro
$crystal = 4000000 ' used crystal frequency
Config Portb = Output
Dim Address As Byte , Command As Byte 'RC5 ir variable
Dim W As Word
Dim Inp_sel As Word
Dim Pwr As Bit
Declare Sub Shiftlf 'name say all for subroutine ...doh!!
Declare Sub Shiftrt
Declare Sub Volup
Declare Sub Voldn
Config Timer1 = Timer , Prescale = 1024
Stop Timer1
Config Rc5 = Pind.7 'pin where is conected ir senzor 'backlight on
Portb = &B00111111 ' PORTB.2 and PORTB.3 motor control lines for alps pot
Portc = &B00111111 ' PORTB.2 and PORTB.3 motor control lines for alps pot
Inp_sel = 0 ' 0 =mute , 1 = normal
Enable Interrupts
Start Timer1
Do
If Pwr = 1 Then
W = Timer1
If W => 156 Then
Set Portd.3
Set Portd.2
End If
Getrc5(address , Command) 'read if we have remote ir command remote work on 17
If Address = 17 Then
Command = Command And &B01111111
Reset Portd.6
End If
Select Case Command
'---- this codes are for my remote , change code to your suit ! ----------------
Case 52 : 'Call Shiftlf 'remote command code for CH up
Case 50 : 'Call Shiftrt 'remote command code for CH down
Case 32 : 'Call Volup 'remote command code for Vol +
Case 33 : 'Call Voldn 'remote command code for Vol -
Case 180 : 'Call Shiftlf 'remote command code for CH up
Case 178 : 'Call Shiftrt 'remote command code for CH down
Case 160 : 'Call Volup 'remote command code for Vol +
Case 161 : 'Call Voldn 'remote command code for Vol -
Case Else : Set Portd.6
End Select
End If
If Pwr = 0 Then
Getrc5(address , Command) 'read if we have remote ir command
If Address = 17 Then
Command = Command And &B01111111
End If
Select Case Command
Case 140 : 'Call Pwronof
Case 12 : 'Call Pwronof
End Select
End If
Loop
End
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> Various 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