Quantcast
Channel: MCS Electronics Forum
Viewing all articles
Browse latest Browse all 20638

BASCOM-AVR : ATmega8 (PinB 0) output problem : REPLY

$
0
0
Yes, It is configured as such: Config Portb = Output '- Set PORTB as Outputs Portb = &HFF '- Set PORTB outputs to a high state All of port b works correctly, except for that pin. I thought maybe it was the IC that had a problem, so I switched it for another, same results as the first IC. So if I just turn the output on and leave it that way it works, and the same with turning it off. But when I instruct it to turn on for anything like a pulse, IE. turn on for 2.0 milliseconds or more, then it gets 50% duty cycle in it. I went ahead and loaded it up on an atmega88 and used atmel studio 6.1 with a jtag unit and did a one wire debug in it. '------------------------------------------------------------------------------- 'Sub: Go Forward: moves the solenoid in the foward direction. '------------------------------------------------------------------------------- Sub Go_Forward PortD.4 = 0 '- PortD PD4 Low level signal (Led Reverse indication) PortD.5 = 1 '- PortD PD5 Low level signal (Led Forward indication) Start Timer2 '- Prepare the timer to start up TimerValue = 0 '- Reset the timer value to zero [color=red:5d438baf9b]Portb.0 = 1 '- PortB PB0 Low level signal (Output for switching the h-bridge)[/color:5d438baf9b] Portb.2 = 0 '- PortB PB2 Low level signal (Output for switching the h-bridge) **** Break point set here **** do Loop Until TimerValue = TargetTime '- Loop until target time is reached Portb.0 = 0 '- PortB PB3 Low level signal (Output for switching the h-bridge) Portb.2 = 0 '- PortB PB4 Low level signal (Output for switching the h-bridge) PortD.4 = 0 '- PortD PD4 Low level signal (Led forward indication) PortD.5 = 0 '- PortD PD5 Low level signal (Led Reverse indication) Stop Timer2 TimerValue = 0 '- Reset the timer value to zero Print "OK" End Sub I set the break point at the color red section, as soon as I step into the: "Portb.0 = 1 '- PortB PB0 Low level signal (Output for switching the h-bridge)" Pinb.0 Starts it duty cycle instead of just turning all the way on. I verified this with my scope. So when instructed to just turn on for a set amount of time it just gives a 50% duty cycle instead of turning full on.

Viewing all articles
Browse latest Browse all 20638

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>